# $Id: Makefile,v 1.8 1998/04/08 02:37:00 lance Exp lance $

# Please don't change the VERSION
VERSION = 0.1.0

#################### EDIT HERE ##############################

# if you install it INSTALL_DIR is the top install directory
#INSTALL_DIR = /usr/local/packages/quickplot-$(VERSION)
#INSTALL_DIR = /usr/freeware/packages/quickplot-$(VERSION)
INSTALL_DIR = /usr/local/encap/quickplot-$(VERSION)

LIBS= -lX11 -lXaw -lXt -L/usr/X11R6/lib

#on HP-UX 10.20 uncomment the two lines below
#CC = cc -Ae -I/usr/include/X11R6 -I/usr/contrib/X11R6/include
#LIBS= -L/usr/lib/X11R6 -lX11 -lXt -lXext -L/usr/contrib/X11R6/lib -lXaw -lXmu

#on SGI's it works

# no need to edit below here to build or install it
##############################################################
################### END EDIT #################################

EXEC = quickplot test_data

QP_OBJS = usage.o add_plots_list.o initialize_Plot_struct.o \
       read_in_data.o get_options.o get_num_lines_to_skip.o \
       get_infilenames.o init_windows.o init_colors.o \
       read_ascii_file.o scale_plot.o plot.o \
       check_plots.o make_labels.o do_event_loop.o \
       malloc_scale_and_stuff.o \
       draw_zoom_box.o read_binary_file.o read_file_utils.o \
       GNUgetopt.o GNUgetopt1.o check_for_stdin.o set_options.o \
       show_point_values.o show_function_values.o icon.o \
       show_true_function_values.o

build: $(EXEC)

install: build
	-mkdir -p $(INSTALL_DIR)/bin
	cp $(EXEC) $(INSTALL_DIR)/bin
	-mkdir -p $(INSTALL_DIR)/man/man1
	cp man/man1/*.1 $(INSTALL_DIR)/man/man1
	@echo
	@echo "                 All Done"
	@echo "Test it by running './test_data | ./quickplot'"
	@echo "You can run [1m'make clean'[0m to remove build files"

test_data: test_data.o GNUgetopt.h GNUgetopt.o GNUgetopt1.o
	$(CC) test_data.o GNUgetopt.o GNUgetopt1.o -o test_data -lm

quickplot: $(QP_OBJS) main.o data.h
	$(CC) $(QP_OBJS) main.o $(LIBS) -o quickplot -lm
	@printf "\nTest it by running: [1m./test_data | ./quickplot[0m\n"

version.h:
	echo "/* DO NOT EDIT THIS FILE ***" > version.h
	echo " * It is generated from make" >> version.h
	echo " */" >> version.h
	printf '#define LANCEMAN_VERSION \"$(VERSION)\"\n' >> version.h

depend:
	makedepend -Y. -fMakefile *.c

clean:
	-rm -f $(EXEC) *.o 

cleano:
	-rm -f *.o

cleaner:
	-rm -f $(EXEC) *.o *~ man/man1/*.1~ version.h Makefile.bak core

get_options.o: version.h

# DO NOT DELETE THIS LINE -- make depend depends on it.

GNUgetopt.o: GNUgetopt.h
GNUgetopt1.o: GNUgetopt.h
add_plots_list.o: data.h
check_plots.o: data.h
do_event_loop.o: data.h xwin.h
draw_zoom_box.o: data.h xwin.h
get_infilenames.o: data.h option.h GNUgetopt.h
get_num_lines_to_skip.o: data.h
get_options.o: data.h option.h GNUgetopt.h version.h
icon.o: QuickPlotIcon.xbm
init_colors.o: data.h xwin.h
init_windows.o: xwin.h data.h
initialize_Plot_struct.o: data.h
main.o: data.h xwin.h
make_labels.o: data.h
malloc_scale_and_stuff.o: data.h
plot.o: data.h xwin.h
read_ascii_file.o: data.h
read_binary_file.o: data.h
read_file_utils.o: data.h
read_in_data.o: data.h
scale_plot.o: data.h xwin.h
set_options.o: option.h GNUgetopt.h
show_function_values.o: xwin.h data.h
show_point_values.o: xwin.h data.h
show_true_function_values.o: xwin.h data.h
test_data.o: GNUgetopt.h
usage.o: data.h
