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