1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
$NetBSD: patch-aa,v 1.2 2010/01/29 01:34:06 minskim Exp $
--- Makefile.orig 1999-12-27 14:27:24.000000000 -0800
+++ 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,24 +134,22 @@ 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)
|