# type 'make' to compile XColorSel.
# type 'make clean' to get rid of the .o files.
# type 'make install' to install XColorSel
# type 'make uninstall' to de-install XColorSel

CC = gcc
# if you do not use gcc as your standard compiler, replace 'gcc' in the line
# above with your own ANSI C compliant compiler.

XLIB = -L/usr/X11/lib -lX11
# Set the XLIB library path on the above line.
# Usually, this path is: "XLIB = -L/usr/X11/lib -lX11" (but not at Fredonia!) :P

INSTALLDIR = /usr/local/bin
# The directory you want xcolorsel installed in

RGBTXTPATH  = /usr/X11/lib/X11/rgb.txt
#path to your system's rgb.txt file

BROWSERPATH = Mosaic  
#command to start your WWW browser of choice (ex: "Mosaic", "netscape", "xterm -e lynx"

###############################################################################
########### You should not have to change anything below this line ############
###############################################################################
all: xcolorsel

xcolorsel: xcolorsel.o XJNSlib.o
	$(CC) -o xcolorsel xcolorsel.o XJNSlib.o $(XLIB)

xcolorsel.o: xcolorsel.jon XJNSlib.h 
	rm -f xcolorsel.c
	echo "#define RGBTXTPATH \"$(RGBTXTPATH)\"" > xcolorsel.c
	echo "#define BROWSERPATH \"$(BROWSERPATH)\"" >> xcolorsel.c
	echo "#define INSTALLDIR \"$(INSTALLDIR)\"" >> xcolorsel.c
	cat xcolorsel.jon >> xcolorsel.c
	$(CC) -c xcolorsel.c 

XJNSlib.o: XJNSlib.h XJNSlib.c
	$(CC) -c XJNSlib.c

clean: 
	rm *.o

install:
	mkdir $(INSTALLDIR)/XCOLORSEL
	mkdir $(INSTALLDIR)/XCOLORSEL/BITMAPS
	mkdir $(INSTALLDIR)/XCOLORSEL/HTMLHELP
	cp BITMAPS/* $(INSTALLDIR)/XCOLORSEL/BITMAPS
	cp HTMLHELP/* $(INSTALLDIR)/XCOLORSEL/HTMLHELP
	cp xcolorsel $(INSTALLDIR)/XCOLORSEL
	ln -s $(INSTALLDIR)/XCOLORSEL/xcolorsel $(INSTALLDIR)/xcolorsel
	chmod -R 755 $(INSTALLDIR)/XCOLORSEL
	
uninstall: 
	rm -Rf $(INSTALLDIR)/XCOLORSEL
	rm $(INSTALLDIR)/xcolorsel
