]> jfr.im git - irc/quakenet/newserv.git/blob - build.mk.in
merge
[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=new
15 @else@
16 HOOK_ENGINE=old
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 @ifdef@ IMPOSSIBLE
49 @error@ impossible combination of settings: ${IMPOSSIBLE}@errorend@
50 @endif@
51
52 @ifndef@ BUILDID
53 BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" @shellend@
54 @endif@
55 MFLAGS+=BUILDID=$(BUILDID)
56
57 .SUFFIXES: .so .y .l
58
59 .o.so:
60 @-ldline-@ $(LDFLAGS)
61
62 .y.c: ;
63
64 .l.c: ;
65
66 .PHONY: checksettings default
67
68 @ifndef@ CHECKEDSETTINGS
69 default: checksettings all
70
71 checksettings:
72 @touch ${INCPATH}/settings.mk
73 @test -f ${INCPATH}/.settings.mk || cp ${INCPATH}/settings.mk ${INCPATH}/.settings.mk
74 @diff ${INCPATH}/.settings.mk ${INCPATH}/settings.mk >/dev/null || $(MAKE) -e FORCECHECK=1 realchecksettings
75
76 realchecksettings:
77
78 @ifdef@ FORCECHECK
79 @error@ you must run make clean if you change settings.mk@errorend@
80 @endif@
81 @endif@
82 MFLAGS+=CHECKEDSETTINGS=1
83
84 CFLAGS+=-Wall -g -finline-functions -funroll-loops
85 @ifndef@ NOC99
86 CFLAGS+=-std=c99
87 @endif@
88 CFLAGS+=-I./ -DBUILDID=$(BUILDID) -fPIC -export-dynamic