File: Makefile.debian

package info (click to toggle)
sgb 1:20030623-3
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 1,868 kB
  • ctags: 28
  • sloc: makefile: 197; sh: 15
file content (219 lines) | stat: -rw-r--r-- 6,293 bytes parent folder | download | duplicates (3)
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# -*- makefile -*-
#   Makefile for the Stanford GraphBase
#   Slightly modified by Milan Zamazal <pdm@fi.muni.cz> for building of Debian
#   package.
#

#   Be sure that CWEB version 3.0 or greater is installed before proceeding!

#   Skip down to "SHORTCUT" if you're going to work only from the
#   current directory. (Not recommended for serious users.)

#   We use DEBROOT as the root of the Debian installation tree.  Note
#   that we don't use mkdir anywhere in this makefile to create the
#   directories, as that will already have been done by one of the
#   debhelper programs.
DEBROOT = debian/sgb

#   Change DATADIR to the directory where GraphBase data files will go.
#   We use INSTALLDATADIR for installation and DATADIR for compiling:
INSTALLDATADIR = $(DEBROOT)/usr/share/sgb
DATADIR = /usr/share/sgb

#   Change INCLUDEDIR to the directory where GraphBase header files will go:
INCLUDEDIR = $(DEBROOT)/usr/include

#   Change LIBDIR to the directory where GraphBase library routines will go:
LIBDIR = $(DEBROOT)/usr/lib

#   Change BINDIR to the directory where installdemos will put demo programs:
BINDIR = $(DEBROOT)/usr/bin

#   Change CWEBINPUTS to the directory where CWEB include files will go:
CWEBINPUTS = $(DEBROOT)/usr/share/texmf/cweb

#   SHORTCUT: Uncomment these lines, for single-directory installation:
#DATADIR = .
#INCLUDEDIR = .
#LIBDIR = .
#BINDIR = .
#CWEBINPUTS = .

#   Uncomment the next line if your C uses <string.h> but not <strings.h>:
#SYS = -DSYSV

CFLAGS = -O2
override CFLAGS += $(SYS)
LFLAGS =
CC = gcc

########## You shouldn't have to change anything after this point ##########

#   Ditto for the order of the library search path.
LDFLAGS = -L.
LDLIBS = -lgb
SOLIBS= libgb.so
LOADLIBES = $(LDLIBS)

.SUFFIXES: .dvi .tex .w

.tex.dvi:
	tex $*.tex

.w.c:
	if test -r $*.ch; then ctangle $*.w $*.ch; else ctangle $*.w; fi

.w.tex:
	if test -r $*.ch; then cweave $*.w $*.ch; else cweave $*.w; fi

.w.o:
	$(MAKE) -f Makefile.debian $*.c
	$(MAKE) -f Makefile.debian $*.o

.c:
	$(CC) $(CFLAGS) $(LFLAGS) -o $* $(LDFLAGS) $< $(LDLIBS)

.o:
	$(CC) $(LFLAGS) -o $* $(LDFLAGS) $< $(LDLIBS)

.w:
	$(MAKE) -f Makefile.debian $*.c
	$(MAKE) -f Makefile.debian $*

.w.dvi:
	$(MAKE) -f Makefile.debian $*.tex
	$(MAKE) -f Makefile.debian $*.dvi

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
GENERATORFILES = gb_basic.w gb_books.w gb_econ.w gb_games.w gb_gates.w \
        gb_lisa.w gb_miles.w gb_plane.w gb_raman.w gb_rand.w gb_roget.w \
        gb_words.w
DEMOFILES = assign_lisa.w book_components.w econ_order.w football.w \
        girth.w ladders.w miles_span.w multiply.w queen.w roget_components.w \
        take_risc.w word_components.w
MISCWEBS = boilerplate.w gb_dijk.w gb_save.w gb_types.w test_sample.w
CHANGEFILES = queen_wrap.ch word_giant.ch
MISCFILES = Makefile README abstract.plaintex cities.texmap blank.w \
        sample.correct test.correct test.dat +The+Stanford+GraphBase+
ALL = $(DATAFILES) $(KERNELFILES) $(GENERATORFILES) $(DEMOFILES) \
        $(MISCWEBS) $(CHANGEFILES) $(MISCFILES)

OBJS = $(KERNELFILES:.w=.o) $(GENERATORFILES:.w=.o) gb_dijk.o gb_save.o
HEADERS = $(OBJS:.o=.h)
DEMOS = $(DEMOFILES:.w=)

help:
	@ echo "First 'make tests';"
	@ echo "then (optionally) become superuser;"
	@ echo "then 'make install';"
	@ echo "then (optionally) 'make install-demos';"
	@ echo "then (optionally) 'make clean'."

lib: libgb.a

solib: libgb.so

libgb.so: $(OBJS)
	rm -f socertified
	# The -Wl,... stuff is to make the library a valid shared library,
	# dynamically rather than statically linked, and having the right
	# output to the file command and having a correct SONAME.
	gcc -shared -o libgb.so $(OBJS) -Wl,-soname,libgb.so.1

libgb.a: $(OBJS)
	rm -f certified
	ar rcv libgb.a $(OBJS)
	- ranlib libgb.a

demos: solib $(DEMOS)

gb_io.o: gb_io.c
	$(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

test_graph: gb_graph.o
	$(CC) $(CFLAGS) test_graph.c gb_graph.o -o test_graph

test_flip: gb_flip.o
	$(CC) $(CFLAGS) test_flip.c gb_flip.o -o test_flip

test_sample_static: test_sample.c
	$(CC) $(CFLAGS) -o test_sample_static test_sample.c $(LDFLAGS) libgb.a

tests: test_io test_graph test_flip
	./test_io
	./test_graph
	./test_flip
	$(MAKE) -f Makefile.debian gb_sort.o
	$(MAKE) -f Makefile.debian lib
	$(MAKE) -f Makefile.debian test_sample_static
	- ./test_sample_static > sample.out
	diff test.gb test.correct
	diff sample.out sample.correct
	rm test.gb sample.out test_io test_graph test_flip test_sample_static
	echo "Congratulations --- the tests have all been passed."
	touch certified

sotests: test_io test_graph test_flip
	./test_io
	./test_graph
	./test_flip
	$(MAKE) -f Makefile.debian gb_sort.o
	$(MAKE) -f Makefile.debian solib
	$(MAKE) -f Makefile.debian test_sample
	- LD_LIBRARY_PATH=. LD_PRELOAD=./libgb.so ./test_sample > sample.out
	diff test.gb test.correct
	diff sample.out sample.correct
	rm test.gb sample.out test_io test_graph test_flip test_sample
	echo "Congratulations --- the sotests have all been passed."
	touch socertified

install-libs:
	if test ! -r certified; then echo "Please run 'make tests' first!"; fi
	test -r certified
	if test ! -r socertified; then echo "Please run 'make sotests' first!"; fi
	test -r socertified
	- cp libgb.a libgb.so $(LIBDIR)
	- cp -p boilerplate.w gb_types.w $(CWEBINPUTS)
	- cp -p $(HEADERS) $(INCLUDEDIR)

install-data: $(DATAFILES)
	- cp -p $(DATAFILES) $(INSTALLDATADIR)

install-demos: demos
	- mv $(DEMOS) $(BINDIR)

uninstall-demos:
	- cd $(BINDIR); rm -f $(DEMOS)

install: install-libs install-data install-demos

doc:
	tex abstract.plaintex

clean:
	rm -f *~ *.o *.c *.h libgb.a libgb.so certified socertified \
	         *.tex *.log *.dvi *.toc *.idx *.scn *.ps core

veryclean: clean
	rm -f $(DEMOS)

sgb.tar: $(ALL)
	tar cvf sgb.tar $(ALL)

floppy: $(ALL)
	bar cvf /dev/rfd0 $(ALL)
	bar tvf /dev/rfd0
	eject

fullfloppy: $(ALL) ERRATA ANSI AMIGA PROTOTYPES
	bar cvf /dev/rfd0 $(ALL) ERRATA ANSI AMIGA PROTOTYPES
	bar tvf /dev/rfd0
	eject

fulltar: $(ALL) ERRATA ANSI AMIGA PROTOTYPES
	tar cvf sgb.tar $(ALL) ERRATA ANSI AMIGA PROTOTYPES