]> jfr.im git - irc/quakenet/newserv.git/blobdiff - build.mk.in
jupe: Clean up single list code.
[irc/quakenet/newserv.git] / build.mk.in
index f39f3b41887f0e91343413eb7e5470f0c55cada0..049b726463d7d26533a79c0dcc0d21908a9dd29c 100644 (file)
@@ -1,92 +1,75 @@
-@ifndef@ INCPATH
+ifndef INCPATH
 INCPATH=../
-@endif@
+endif
 
+CONFIGURED=1
 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@
+ifeq (${HOOKS_NEW},1)
 HOOK_ENGINE=new
-@endif@
+else
+HOOK_ENGINE=old
+endif
 
 # if USE_VALGRIND == 1
-@ifeq@${USE_VALGRIND}@ifeqsep@1@ifeqend@
+ifeq (${USE_VALGRIND},1)
   CFLAGS+=-DUSE_VALGRIND
   SSTRING_ENGINE=valgrind
 
 ## if SSTRING_NEW == 1
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
+ifeq (${SSTRING_NEW},1)
     IMPOSSIBLE="USE_VALGRIND and SSTRING_NEW"
-@endif@ # SSTRING_NEW == 1
+endif # SSTRING_NEW == 1
 
 ## if SSTRING_MMAP == 1
-@ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
+ifeq (${SSTRING_MMAP},1)
     IMPOSSIBLE="USE_VALGRIND and SSTRING_MMAP"
-@endif@ ## SSTRING_MMAP == 1
-@else@ # USE_VALGRIND == 1
+endif ## SSTRING_MMAP == 1
+else # USE_VALGRIND == 1
 
 ## if SSTRING_NEW == 1
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
+ifeq (${SSTRING_NEW},1)
     SSTRING_ENGINE=new
-@else@ ## SSTRING_NEW == 1
+else ## SSTRING_NEW == 1
     SSTRING_ENGINE=old
 
 ### if SSTRING_MMAP == 1
-@ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
+ifeq (${SSTRING_MMAP},1)
       IMPOSSIBLE="SSTRING_MMAP without SSTRING_NEW"
-@endif@ ### SSTRING_MMAP == 1
-@endif@ ## SSTRING_NEW == 1
-@endif@ # USE_VALGRIND == 1
+endif ### SSTRING_MMAP == 1
+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@
+ifdef IMPOSSIBLE
+$(error impossible combination of settings: ${IMPOSSIBLE})
+endif
 
-@ifndef@ BUILDID
-BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/+ /-/;s/ /-/" @shellend@
-@endif@
+ifndef BUILDID
+BUILDID = $(shell (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" )
+endif
 MFLAGS+=BUILDID=$(BUILDID)
 
+default: all
+
 .SUFFIXES: .so .y .l
 
+-include $(wildcard *.d)
+
+.c.o:
+       $(CC) $(CFLAGS) -MMD -c -o $@ $<
+
 .o.so:
-       @-ldline-@ $(LDFLAGS)
+       $(CC) -nostartfiles -Wl,--export-dynamic -shared -o $@ $^ $(LDFLAGS)
 
 .y.c:  ;
 
 .l.c:  ;
 
-.PHONY: checksettings default
-
-@ifndef@ CHECKEDSETTINGS
-default: checksettings all
-
-checksettings:
-       echo checked settings
-       @touch settings.mk
-       @test -f .settings.mk || cp settings.mk .settings.mk
-       @diff .settings.mk 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
 
-CFLAGS+=-Wall -g -finline-functions -funroll-loops -std=c99 -I./ -DBUILDID=$(BUILDID)
-CFLAGS+=-fPIC -export-dynamic
+ifndef NOC99
+CFLAGS+=-std=c99
+endif