# --------------------------------------------------------------------------
#
# Makefile for xcolmix
#
# --------------------------------------------------------------------------

# Note: you will need the XForms library to get things compiled. You can
# obtain the library at one of the Linux ftp sites (sunsite.unc.edu,
# tsx-11.mit.edu) or at the primary sites: bloch.phys.uwm.edu:/pub/xforms
# and ftp.cs.ruu.nl:/pub/XFORMS.

# If you have installed XForms as the Makefile of the package does, you won't
# have any problems compiling all. Otherwise, set XFLIBDIR to "-L..." (the
# directory where the library lives) and XFLIBINC to "-I..." (the directory
# where the include file forms.h lives).
# XFLIBDIR= -L/usr/X11R6/lib
# XFINCDIR = -I/usr/local/inc

# A `make install' will create a stripped version of xcolmix and install it
# to BINDIR. Define that directory here. If you want to make the program first
# to check it out, before installing it, must do a `make final' before the
# `make install'.
prefix = /usr/local
BINDIR = $(prefix)/bin
MANDIR = $(prefix)/man/man1

# Standard compilation flags. You probably won't have to change these, if
# you are using gcc.
STDCFLAGS = -c -O2 -Wall $(XFINCDIR)
STDLFLAGS = -s -L/usr/X11R6/lib

# Compilation flags for `make debug'. Again, OK for gcc.
DEBUGCFLAGS = -g
DEBUGLFLAGS = -static

# You have edited enough. Now run `make'.
# --------------------------------------------------------------------------


# objects we need for the program
OBJ =  xcolmix.o callbacks.o initforms.o makecolor.o usage.o design.o \
       loadlookupbrowser.o

foobar:
	@echo 'Make what? Choose one of:'
	@echo 'make final : make final version of xcolmix'
	@echo 'make debug : make debugging version of xcolmix'
	@echo 'make clean : remove objects and binary'
	@echo 'make install : make final version and install to' $(BINDIR)
	@echo 'make dist : make distribution (for me, Karel, only)'
	exit 1

final:
	make xcolmix CFLAGS="$(STDCFLAGS)" LFLAGS="$(STDLFLAGS)"

debug:
	make xcolmix CFLAGS="$(STDCFLAGS) $(DEBUGCFLAGS)" \
	    LFLAGS="$(DEBUGLFLAGS)"

clean:
	rm -f xcolmix $(OBJ)

install: final
	install -s xcolmix $(BINDIR)
	install -m 644  xcolmix.1  $(MANDIR)/xcolmix.1

xcolmix: $(OBJ)
	$(CC) -o xcolmix.new $(OBJ) $(XFLIBDIR) -lforms -lX11 -lm $(LFLAGS)
	mv xcolmix.new xcolmix

dist: clean
	header -ak0 design.h design.c
	header -rk *.c *.h
	.makedist $(BINDIR)


# extra deps
initforms.o: initforms.c version.h
usage.o: usage.c version.h
