$NetBSD: patch-ab,v 1.2 2003/04/29 22:22:45 jtb Exp $

--- makefile.orig
+++ makefile
@@ -6,7 +6,7 @@
 # view docs/index.html with any Web browser.
 
 
-#INSTALL_DIR = /usr/local
+INSTALL_DIR = $(PREFIX)
 
 
 # Changes for other systems:
@@ -28,7 +28,8 @@
 # If you do not have M_PI or PI and need pi with more than 16 digits
 # define it -DPI=3.1415... (not necessary for 8 byte doubles)
 
-CC=gcc -Wall -O2 -DINSTALL_DIR=\"$(INSTALL_DIR)\"
+CLFAGS+= -Wall
+CPPFLAGS+= -DINSTALL_DIR=\"$(INSTALL_DIR)\"
 
 
 # This is for printing the DOC on your local printer
@@ -45,8 +46,8 @@
 
 
 euler: $(OBJS) main.o rc.o earray.o term.o metagtk.o colbut.o
-	$(CC) -o euler main.o rc.o earray.o term.o metagtk.o colbut.o $(OBJS) -lm `gtk-config --libs`
-	
+	$(CC) $(CPPFLAGS) $(CFLAGS) -o euler main.o rc.o earray.o term.o metagtk.o colbut.o $(OBJS) -lm `gtk-config --libs`
+
 imported: import.cpp
 	g++ -o import import.cpp
 	./import *.cpp *.h help.txt euler.cfg
@@ -59,104 +60,104 @@
 #	object file dependances
 #
 binary.o :	sysdep.h stack.h output.h binary.h binary.c
-	$(CC) -c  binary.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  binary.c
 
 builtin.o :	sysdep.h stack.h builtin.h builtin.c
-	$(CC) -c  builtin.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  builtin.c
 
 command.o :	stack.h command.h builtin.h udf.h express.h command.c
-	$(CC) -c  command.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  command.c
 
 edit.o :	sysdep.h graphics.h edit.c
-	$(CC) -c  edit.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  edit.c
 
 express.o :	sysdep.h stack.h output.h funcs.h interval.h builtin.h express.h\
 			spread.h udf.h matrix.h command.h input.h express.c
-	$(CC) -c  express.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  express.c
 
 feval.o :	stack.h output.h builtin.h udf.h mainloop.h feval.c
-	$(CC) -c  feval.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  feval.c
 
 fft.o : sysdep.h stack.h output.h linear.h fft.h fft.c
-	$(CC) -c  fft.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  fft.c
 
 funcs.o :	sysdep.h stack.h output.h builtin.h funcs.h linear.h polynom.h\
 			interval.h spread.h express.h udf.h mainloop.h edit.h funcs.c
-	$(CC) -c  funcs.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  funcs.c
 
 graphics.o :sysdep.h stack.h output.h funcs.h express.h matrix.h meta.h\
 			graphics.h graphics.c
-	$(CC) -c  graphics.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  graphics.c
 
 help.o :	output.h help.h help.c
-	$(CC) -c  help.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  help.c
 
 input.o :	sysdep.h input.c
-	$(CC) -c  input.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  input.c
 
 interval.o : interval.h spread.h stack.h interval.c
-	$(CC) -c  interval.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  interval.c
 
 linear.o :	sysdep.h stack.h output.h interval.h mainloop.h\
 			linear.h linear.c
-	$(CC) -c  linear.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  linear.c
 
 mainloop.o : sysdep.h funcs.h graphics.h version.h\
 	interval.h builtin.h stack.h meta.h mainloop.c
-	$(CC) `glib-config --cflags` -c  mainloop.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `glib-config --cflags` -c  mainloop.c
 
 matrix.o :	stack.h output.h funcs.h interval.h linear.h mainloop.h\
 			matrix.h matrix.c
-	$(CC) -c  matrix.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  matrix.c
 
 meta.o:		sysdep.h meta.h meta.c
-	$(CC) -c meta.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c meta.c
 
 metaps.o:	sysdep.h meta.h metaps.h metaps.c
-	$(CC) -c metaps.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c metaps.c
 
 output.o :	sysdep.h output.c
-	$(CC) -c  output.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  output.c
 
 polynom.o : polynom.h funcs.h linear.h interval.h\
 	express.h stack.h polynom.c
-	$(CC) -c  polynom.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  polynom.c
 
 psgraph.o : psgraph.h psgraph.c
-	$(CC) -c psgraph.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c psgraph.c
 
 scalp.o :	interval.h express.h stack.h scalp.c
-	$(CC) -c  scalp.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  scalp.c
 
 special.o : stack.h spread.h special.c
-	$(CC) -c  special.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  special.c
 
 spread.o : stack.h output.h spread.h builtin.h udf.h spread.c
-	$(CC) -c  spread.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  spread.c
 
 stack.o : sysdep.h stack.h stack.c
-	$(CC) -c  stack.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  stack.c
 
 udf.o : sysdep.h stack.h udf.c help.h
-	$(CC) -c  udf.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) -c  udf.c
 
 main.o : main.c rc.h earray.h term.h metagtk.h metaps.h
-	$(CC) `gtk-config --cflags` -c  main.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c  main.c
 
 rc.o :		rc.c rc.h
-	$(CC) `gtk-config --cflags` -c  rc.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c  rc.c
 
 earray.o : earray.c earray.h
-	$(CC) `gtk-config --cflags` -c  earray.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c  earray.c
 
 term.o : term.c term.h earray.h
-	$(CC) `gtk-config --cflags` -c term.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c term.c
 
 metagtk.o : metagtk.c metagtk.h meta.h
-	$(CC) `gtk-config --cflags` -c metagtk.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c metagtk.c
 
 colbut.o : colbut.c colbut.h
-	$(CC) `gtk-config --cflags` -c colbut.c
+	$(CC) $(CPPFLAGS) $(CFLAGS) `gtk-config --cflags` -c colbut.c
 
 #
 #	install
@@ -165,10 +166,18 @@
 	if [ ! -d "$(INSTALL_DIR)/share/euler" ]; then mkdir $(INSTALL_DIR)/share/euler ; fi
 	if [ ! -d "$(INSTALL_DIR)/share/doc" ]; then mkdir $(INSTALL_DIR)/share/doc ; fi
 	if [ ! -d "$(INSTALL_DIR)/share/doc/euler" ]; then mkdir $(INSTALL_DIR)/share/doc/euler ; fi
-	cp -f euler $(INSTALL_DIR)/bin
-	cp -fr ../progs $(INSTALL_DIR)/share/euler
-	cp -fr ../docs/* $(INSTALL_DIR)/share/doc/euler/
-	cp -f help.txt $(INSTALL_DIR)/share/euler
+	$(BSD_INSTALL_PROGRAM) euler $(INSTALL_DIR)/bin
+	$(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)/share/euler
+	$(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)/share/euler/progs/user
+	$(BSD_INSTALL_DATA) ../progs/*.* $(INSTALL_DIR)/share/euler/progs
+	$(BSD_INSTALL_DATA) ../progs/user/*.* $(INSTALL_DIR)/share/euler/progs/user
+	$(BSD_INSTALL_DATA) help.txt $(INSTALL_DIR)/share/euler
+	$(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)/share/doc/euler
+	$(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)/share/doc/euler/images
+	$(BSD_INSTALL_DATA_DIR) $(INSTALL_DIR)/share/doc/euler/reference
+	$(BSD_INSTALL_DATA) ../docs/*.* $(INSTALL_DIR)/share/doc/euler/
+	$(BSD_INSTALL_DATA) ../docs/images/* $(INSTALL_DIR)/share/doc/euler/images
+	$(BSD_INSTALL_DATA) ../docs/reference/*.* $(INSTALL_DIR)/share/doc/euler/reference
 
 #
 #	uninstall
