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