]> jfr.im git - irc/quakenet/newserv.git/blobdiff - build.mk.in
fixes for clang
[irc/quakenet/newserv.git] / build.mk.in
index 01360fc3de92a6026b4585d318a468b2a8b19175..fca81a56e433b620ae1a0f02129a21d3e546642a 100644 (file)
@@ -3,16 +3,16 @@ INCPATH=../
 @endif@
 
 CFLAGS=
-CC=gcc
 LEX=flex
+MFLAGS=
 
 @sinclude@ @includel@$(INCPATH)defaults.mk@includel@
 @sinclude@ @includel@$(INCPATH)settings.mk@includel@
 
 @ifeq@${HOOKS_NEW}@ifeqsep@1@ifeqend@
-HOOK_ENGINE=old
-@else@
 HOOK_ENGINE=new
+@else@
+HOOK_ENGINE=old
 @endif@
 
 # if USE_VALGRIND == 1
@@ -44,19 +44,14 @@ HOOK_ENGINE=new
 @endif@ ## SSTRING_NEW == 1
 @endif@ # USE_VALGRIND == 1
 
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
-HOOK_ENGINE=old
-@else@
-HOOK_ENGINE=new
-@endif@
-
 @ifdef@ IMPOSSIBLE
 @error@ impossible combination of settings: ${IMPOSSIBLE}@errorend@
 @endif@
 
 @ifndef@ BUILDID
-BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/+ /-/;s/ /-/" @shellend@
+BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" @shellend@
 @endif@
+MFLAGS+=BUILDID=$(BUILDID)
 
 .SUFFIXES: .so .y .l
 
@@ -69,18 +64,29 @@ BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/+ /-/;s/ /-/" @shellend@
 
 .PHONY: checksettings default
 
+@ifndef@ CHECKEDSETTINGS
 default: checksettings all
 
 checksettings:
-       @touch settings.mk
-       @test -f .settings.mk || cp settings.mk .settings.mk
-       @diff .settings.mk settings.mk >/dev/null || $(MAKE) -e FORCECHECK=1 realchecksettings
+       @touch ${INCPATH}/settings.mk
+       @test -f ${INCPATH}/.settings.mk || cp ${INCPATH}/settings.mk ${INCPATH}/.settings.mk
+       @diff ${INCPATH}/.settings.mk ${INCPATH}/settings.mk >/dev/null || $(MAKE) -e FORCECHECK=1 realchecksettings
 
 realchecksettings:
 
 @ifdef@ FORCECHECK
 @error@ you must run make clean if you change settings.mk@errorend@
 @endif@
+@endif@
+MFLAGS+=CHECKEDSETTINGS=1
+
+CFLAGS+=-I./ -DBUILDID=$(BUILDID) -fPIC
+CFLAGS+=-Wall -g -finline-functions -funroll-loops -Werror=format-security
+
+@ifndef@ CLANG
+@ifndef@ NOC99
+CFLAGS+=-std=c99
+@endif@
+CFLAGS+=-export-dynamic
+@endif@
 
-CFLAGS+=-Wall -g -finline-functions -funroll-loops -std=c99 -I./ -DBUILDID=$(BUILDID)
-CFLAGS+=-fPIC -export-dynamic