1 # |
1 ## |
2 # libtu Makefile |
2 ## libtu Makefile |
3 # |
3 ## |
4 |
4 |
5 # Where to install? ($PREFIX/lib/libtu.a, $PREFIX/include/libtu/) |
5 # System-specific configuration is in system.mk |
6 # |
6 include system.mk |
7 PREFIX=/usr/local |
|
8 |
|
9 # Any extra defines needed |
|
10 # |
|
11 #DEFINES= |
|
12 |
|
13 # Any extra include paths needed |
|
14 # |
|
15 #INCLUDES= |
|
16 |
|
17 ###################################### |
|
18 |
|
19 WARN= -W -Wimplicit -Wreturn-type -Wswitch -Wcomment \ |
|
20 -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized \ |
|
21 -Wparentheses -pedantic-errors |
|
22 |
|
23 CC_FLAGS=-g -O2 -ansi $(DEFINES) $(INCLUDES) $(WARN) |
|
24 CC=gcc |
|
25 AR=ar |
|
26 AR_FLAGS=crs |
|
27 |
|
28 INSTALL=install |
|
29 MODE=644 |
|
30 |
7 |
31 ###################################### |
8 ###################################### |
32 |
9 |
33 OBJS= misc.o output.o util.o optparser.o parser.o tokenizer.o |
10 OBJS= misc.o output.o util.o optparser.o parser.o tokenizer.o |
34 |
|
35 DEPEND= .depend |
|
36 |
11 |
37 LIBDIR=$(PREFIX)/lib |
12 LIBDIR=$(PREFIX)/lib |
38 INCDIR=$(PREFIX)/include/libtu |
13 INCDIR=$(PREFIX)/include/libtu |
39 |
14 |
40 TARGETS=libtu.a |
15 TARGETS=libtu.a |
41 TESTERS=tester tester2 tester3 |
16 TESTERS=tester tester2 tester3 |
42 |
17 |
43 ###################################### |
18 ###################################### |
44 |
19 |
45 all: $(TARGETS) |
20 include rules.mk |
|
21 |
|
22 ###################################### |
46 |
23 |
47 testers: $(TESTERS) |
24 testers: $(TESTERS) |
48 |
25 |
49 libtu.a: $(OBJS) |
26 libtu.a: $(OBJS) |
50 $(AR) $(AR_FLAGS) $@ $+ |
27 $(AR) $(AR_FLAGS) $@ $+ |
51 |
28 |
52 %: %.c libtu.a |
29 %: %.c libtu.a |
53 $(CC) $(CC_FLAGS) $+ -L. -ltu -lm -o $@ |
30 $(CC) $(CC_FLAGS) $+ -L. -ltu -lm -o $@ |
54 |
31 |
55 %.o: %.c |
32 _install: |
56 $(CC) $(CC_FLAGS) -c $< -o $@ |
|
57 |
|
58 clean: |
|
59 rm -f $(OBJS) $(DEPEND) |
|
60 |
|
61 realclean: clean |
|
62 rm -f $(TARGETS) |
|
63 |
|
64 depend: |
|
65 $(CC) -M $(CC_FLAGS) *.c > $(DEPEND) |
|
66 |
|
67 install: |
|
68 $(INSTALL) -d $(LIBDIR) |
33 $(INSTALL) -d $(LIBDIR) |
69 $(INSTALL) -d $(INCDIR) |
34 $(INSTALL) -d $(INCDIR) |
70 $(INSTALL) -m $(MODE) libtu.a $(LIBDIR) |
35 $(INSTALL) -m $(DATA_MODE) libtu.a $(LIBDIR) |
71 $(INSTALL) -m $(MODE) include/* $(INCDIR) |
36 $(INSTALL) -m $(DATA_MODE) include/*.h $(INCDIR) |
72 |
37 |
73 ifeq ($(DEPEND),$(wildcard $(DEPEND))) |
|
74 include $(DEPEND) |
|
75 endif |
|