]> jfr.im git - irc/quakenet/newserv.git/blob - build.mk.in
BSD make fixes.
[irc/quakenet/newserv.git] / build.mk.in
1 @ifndef@ INCPATH
2 INCPATH=../
3 @endif@
4
5 CFLAGS=
6 CC=gcc
7 LEX=flex
8
9 @sinclude@ @includel@$(INCPATH)defaults.mk@includel@
10 @sinclude@ @includel@$(INCPATH)settings.mk@includel@
11
12 @ifeq@${HOOKS_NEW}@ifeqsep@1@ifeqend@
13 HOOK_ENGINE=old
14 @else@
15 HOOK_ENGINE=new
16 @endif@
17
18 # if USE_VALGRIND == 1
19 @ifeq@${USE_VALGRIND}@ifeqsep@1@ifeqend@
20 CFLAGS+=-DUSE_VALGRIND
21 SSTRING_ENGINE=valgrind
22
23 ## if SSTRING_NEW == 1
24 @ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
25 IMPOSSIBLE="USE_VALGRIND and SSTRING_NEW"
26 @endif@ # SSTRING_NEW == 1
27
28 ## if SSTRING_MMAP == 1
29 @ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
30 IMPOSSIBLE="USE_VALGRIND and SSTRING_MMAP"
31 @endif@ ## SSTRING_MMAP == 1
32 @else@ # USE_VALGRIND == 1
33
34 ## if SSTRING_NEW == 1
35 @ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
36 SSTRING_ENGINE=new
37 @else@ ## SSTRING_NEW == 1
38 SSTRING_ENGINE=old
39
40 ### if SSTRING_MMAP == 1
41 @ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
42 IMPOSSIBLE="SSTRING_MMAP without SSTRING_NEW"
43 @endif@ ### SSTRING_MMAP == 1
44 @endif@ ## SSTRING_NEW == 1
45 @endif@ # USE_VALGRIND == 1
46
47 @ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
48 HOOK_ENGINE=old
49 @else@
50 HOOK_ENGINE=new
51 @endif@
52
53 @ifdef@ IMPOSSIBLE
54 @error@ impossible combination of settings: ${IMPOSSIBLE}@errorend@
55 @endif@
56
57 @ifndef@ BUILDID
58 BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/+ /-/;s/ /-/" @shellend@
59 @endif@
60
61 .SUFFIXES: .so .y .l
62
63 .o.so:
64 @-ldline-@ $(LDFLAGS)
65
66 .y.c: ;
67
68 .l.c: ;
69
70 .PHONY: checksettings default
71
72 default: checksettings all
73
74 checksettings:
75 @touch settings.mk
76 @test -f .settings.mk || cp settings.mk .settings.mk
77 @diff .settings.mk settings.mk >/dev/null || $(MAKE) -e FORCECHECK=1 realchecksettings
78
79 realchecksettings:
80
81 @ifdef@ FORCECHECK
82 @error@ you must run make clean if you change settings.mk@errorend@
83 @endif@
84
85 CFLAGS+=-Wall -g -finline-functions -funroll-loops -std=c99 -I./ -DBUILDID=$(BUILDID)
86 CFLAGS+=-fPIC -export-dynamic