$NetBSD: patch-aa,v 1.3 2010/06/13 19:07:24 minskim Exp $ --- Makefile.orig 1999-12-27 22:27:24.000000000 +0000 +++ Makefile @@ -8,22 +8,22 @@ # current directory. (Not recommended for serious users.) # Change SGBDIR to the directory where all GraphBase files will go: -SGBDIR = /usr/local/sgb +SGBDIR = @PREFIX@/share/sgb # Change DATADIR to the directory where GraphBase data files will go: DATADIR = $(SGBDIR)/data # Change INCLUDEDIR to the directory where GraphBase header files will go: -INCLUDEDIR = $(SGBDIR)/include +INCLUDEDIR = @PREFIX@/include # Change LIBDIR to the directory where GraphBase library routines will go: -LIBDIR = /usr/local/lib +LIBDIR = @PREFIX@/lib # Change BINDIR to the directory where installdemos will put demo programs: -BINDIR = /usr/local/bin +BINDIR = @PREFIX@/bin # Change CWEBINPUTS to the directory where CWEB include files will go: -CWEBINPUTS = /usr/local/lib/cweb +CWEBINPUTS = @PREFIX@/lib/cweb # SHORTCUT: Uncomment these lines, for single-directory installation: #DATADIR = . @@ -36,11 +36,11 @@ CWEBINPUTS = /usr/local/lib/cweb #SYS = -DSYSV # If you prefer optimization to debugging, change -g to something like -O: -CFLAGS = -g -I$(INCLUDEDIR) $(SYS) +CFLAGS += -I$(INCLUDEDIR) $(SYS) ########## You shouldn't have to change anything after this point ########## -LDFLAGS = -L. -L$(LIBDIR) +LDFLAGS += -L. -L$(LIBDIR) LDLIBS = -lgb LOADLIBES = $(LDLIBS) @@ -50,7 +50,7 @@ LOADLIBES = $(LDLIBS) tex $*.tex .w.c: - if test -r $*.ch; then ctangle $*.w $*.ch; else ctangle $*.w; fi + if test -r $*.ch; then @LOCALBASE@/bin/ctangle $*.w $*.ch; else @LOCALBASE@/bin/ctangle $*.w; fi .w.tex: if test -r $*.ch; then cweave $*.w $*.ch; else cweave $*.w; fi @@ -67,6 +67,12 @@ LOADLIBES = $(LDLIBS) make $*.tex make $*.dvi +.c.o: + ${LIBTOOL} --mode=compile ${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c + +.c: + ${LIBTOOL} --mode=link ${CC} -o $* $*.c ${LDLIBS} + DATAFILES = anna.dat david.dat econ.dat games.dat homer.dat huck.dat \ jean.dat lisa.dat miles.dat roget.dat words.dat KERNELFILES = gb_flip.w gb_graph.w gb_io.w gb_sort.w @@ -98,20 +104,20 @@ lib: libgb.a libgb.a: $(OBJS) rm -f certified - ar rcv libgb.a $(OBJS) - - ranlib libgb.a + ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} \ + -rpath ${PREFIX}/lib -version-info 0:0 gb_io.o: gb_io.c - $(CC) $(CFLAGS) -DDATA_DIRECTORY=\"$(DATADIR)/\" -c gb_io.c + ${LIBTOOL} --mode=compile $(CC) $(CFLAGS) -DDATA_DIRECTORY=\"$(DATADIR)/\" -c gb_io.c test_io: gb_io.o - $(CC) $(CFLAGS) test_io.c gb_io.o -o test_io + ${LIBTOOL} --mode=link $(CC) $(CFLAGS) test_io.c gb_io.lo -o test_io test_graph: gb_graph.o - $(CC) $(CFLAGS) test_graph.c gb_graph.o -o test_graph + ${LIBTOOL} --mode=link $(CC) $(CFLAGS) test_graph.c gb_graph.lo -o test_graph test_flip: gb_flip.o - $(CC) $(CFLAGS) test_flip.c gb_flip.o -o test_flip + ${LIBTOOL} --mode=link $(CC) $(CFLAGS) test_flip.c gb_flip.lo -o test_flip tests: test_io test_graph test_flip ./test_io @@ -128,30 +134,28 @@ tests: test_io test_graph test_flip touch certified install: lib - if test ! -r certified; then echo "Please run 'make tests' first!"; fi - test -r certified make installdata - - mkdir $(LIBDIR) - - cp libgb.a $(LIBDIR) - - mkdir $(CWEBINPUTS) - - cp -p boilerplate.w gb_types.w $(CWEBINPUTS) - - mkdir $(INCLUDEDIR) - - cp -p $(HEADERS) Makefile $(INCLUDEDIR) + - ${BSD_INSTALL_LIB_DIR} $(LIBDIR) + - ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} libgb.la $(LIBDIR) + - ${BSD_INSTALL_DATA_DIR} $(CWEBINPUTS) + - ${BSD_INSTALL_DATA} boilerplate.w gb_types.w $(CWEBINPUTS) + - ${BSD_INSTALL_DATA_DIR} $(INCLUDEDIR) + - ${BSD_INSTALL_DATA} $(HEADERS) $(INCLUDEDIR) installdata: $(DATAFILES) - - mkdir $(SGBDIR) - - mkdir $(DATADIR) - - cp -p $(DATAFILES) $(DATADIR) + - ${BSD_INSTALL_DATA_DIR} $(SGBDIR) + - ${BSD_INSTALL_DATA_DIR} $(DATADIR) + - ${BSD_INSTALL_DATA} $(DATAFILES) $(DATADIR) installdemos: lib $(DEMOS) - - mkdir $(BINDIR) - - mv $(DEMOS) $(BINDIR) + - ${BSD_INSTALL_PROGRAM_DIR} $(BINDIR) + - ${BSD_INSTALL_PROGRAM} $(DEMOS) $(BINDIR) uninstalldemos: - cd $(BINDIR); rm -f $(DEMOS) doc: - tex abstract.plaintex + @LOCALBASE@/bin/tex abstract.plaintex clean: rm -f *~ *.o *.c *.h libgb.a certified \