]> jfr.im git - irc/quakenet/newserv.git/blobdiff - build.mk.in
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / build.mk.in
index 33598acf08f01d4d92017c1d53c2f8475d0edbb9..efd26ce8eab4e4e3946be1ea570ff32dafda75c8 100644 (file)
@@ -1,88 +1,44 @@
-@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@
+ifeq (${HOOKS_NEW},1)
 HOOK_ENGINE=new
-@else@
+else
 HOOK_ENGINE=old
-@endif@
-
-# if USE_VALGRIND == 1
-@ifeq@${USE_VALGRIND}@ifeqsep@1@ifeqend@
-  CFLAGS+=-DUSE_VALGRIND
-  SSTRING_ENGINE=valgrind
-
-## if SSTRING_NEW == 1
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
-    IMPOSSIBLE="USE_VALGRIND and SSTRING_NEW"
-@endif@ # SSTRING_NEW == 1
+endif
 
-## if SSTRING_MMAP == 1
-@ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
-    IMPOSSIBLE="USE_VALGRIND and SSTRING_MMAP"
-@endif@ ## SSTRING_MMAP == 1
-@else@ # USE_VALGRIND == 1
+ifndef BUILDID
+BUILDID := "$(shell (git describe --long --dirty --all --abbrev=10 || echo "unknown"))"
+endif
+MFLAGS+=BUILDID='${BUILDID}'
 
-## if SSTRING_NEW == 1
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
-    SSTRING_ENGINE=new
-@else@ ## SSTRING_NEW == 1
-    SSTRING_ENGINE=old
+default: all
 
-### if SSTRING_MMAP == 1
-@ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
-      IMPOSSIBLE="SSTRING_MMAP without SSTRING_NEW"
-@endif@ ### SSTRING_MMAP == 1
-@endif@ ## SSTRING_NEW == 1
-@endif@ # USE_VALGRIND == 1
-
-@ifdef@ IMPOSSIBLE
-@error@ impossible combination of settings: ${IMPOSSIBLE}@errorend@
-@endif@
+.SUFFIXES: .so .y .l
 
-@ifndef@ BUILDID
-BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" @shellend@
-@endif@
-MFLAGS+=BUILDID=$(BUILDID)
+-include $(wildcard .deps/*.d)
 
-.SUFFIXES: .so .y .l
+.c.o:
+       @if [ ! -d .deps ]; then mkdir .deps || true; fi
+       $(CC) $(CFLAGS) -MMD -MF .deps/$(subst .o,.d,$@) -fPIC -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:
-       @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. -I.. -DBUILDID='${BUILDID}'
+CFLAGS+=-Wall -g -finline-functions -funroll-loops -Werror=format-security
+EXECFLAGS=
 
-CFLAGS+=-Wall -g -finline-functions -funroll-loops
-@ifndef@ NOC99
+ifndef NOC99
 CFLAGS+=-std=c99
-@endif@
-CFLAGS+=-I./ -DBUILDID=$(BUILDID) -fPIC -export-dynamic
+endif