]> jfr.im git - irc/quakenet/newserv.git/blobdiff - build.mk.in
CHANSERV: better batcher error handling for expired accounts/accounts with no email.
[irc/quakenet/newserv.git] / build.mk.in
index 9b4d6ae3ec0c010424b11500f7e2733651c7f107..3049edd7cd829eea1332e8053ada2639cab930c8 100644 (file)
@@ -1,85 +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@
-HOOK_ENGINE=old
-@else@
+ifeq (${HOOKS_NEW},1)
 HOOK_ENGINE=new
-@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@
-
-  # if SSTRING_MMAP == 1
-  @ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
-    IMPOSSIBLE="USE_VALGRIND and SSTRING_MMAP"
-  @endif@
-@else@
-
-  # if SSTRING_NEW == 1
-  @ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
-    SSTRING_ENGINE=new
-  @else@
-    SSTRING_ENGINE=old
-
-    # if SSTRING_MMAP == 1
-    @ifeq@${SSTRING_MMAP}@ifeqsep@1@ifeqend@
-      IMPOSSIBLE="SSTRING_MMAP without SSTRING_NEW"
-    @endif@
-  @endif@
-@endif@
-
-@ifeq@${SSTRING_NEW}@ifeqsep@1@ifeqend@
+else
 HOOK_ENGINE=old
-@else@
-HOOK_ENGINE=new
-@endif@
+endif
 
-@ifdef@ IMPOSSIBLE
-@error@ impossible combination of settings: ${IMPOSSIBLE}@errorend@
-@endif@
+ifndef BUILDID
+BUILDID := $(shell (hg id || echo "unknown") | sed -e "s/[()]//g;s/+ /+/g;s/ /-/g" )
+endif
+MFLAGS+=BUILDID=$(BUILDID)
 
-@ifndef@ BUILDID
-BUILDID @shell@ (hg id || echo "unknown") | sed -e "s/+ /-/;s/ /-/" @shellend@
-@endif@
+default: all
 
 .SUFFIXES: .so .y .l
 
+-include $(wildcard .deps/*.d)
+
+.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
-
-default: checksettings all
-
-checksettings:
-       @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@
+CFLAGS+=-I. -I.. -DBUILDID=$(BUILDID)
+CFLAGS+=-Wall -g -finline-functions -funroll-loops -Werror=format-security
+EXECFLAGS=
 
-CFLAGS+=-Wall -g -finline-functions -funroll-loops -std=c99 -I./ -DBUILDID=$(BUILDID)
-CFLAGS+=-fPIC -export-dynamic
+ifndef NOC99
+CFLAGS+=-std=c99
+endif