]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Unify settings into defaults.mk and settings.mk.
authorChris Porter <redacted>
Sun, 12 Oct 2008 20:30:31 +0000 (21:30 +0100)
committerChris Porter <redacted>
Sun, 12 Oct 2008 20:30:31 +0000 (21:30 +0100)
Now you can choose sstring/hook/event engines by setting a line in settings.mk instead of messing around with defines.

build.mk.in
core/Makefile.in
defaults.mk
lib/Makefile.in
lib/sstring [deleted file]
lib/sstring-new.h [deleted file]
lib/sstring-old.h [deleted file]
newsearch/Makefile.in

index bcdfa1ba51960dd4ff3935ceaa781f3211a58fbe..e6198152a03cbb2e52709d1b2d50627fcaf2d13d 100644 (file)
@@ -9,6 +9,51 @@ LEX=flex
 @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
+@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@
+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@
 @endif@
index e6ffb51fcb394c1ea572650a3a59ba367dbd7d11..05766393c58d7fbaaf1b1ed3ca4b601bcac28bcb 100644 (file)
@@ -1,37 +1,7 @@
 @include@ @includel@../build.mk@includel@
 
-default: all
-
-.PHONY: kqueue epoll poll hooks-new hooks-old
-
-events.c:
-       rm -f events.c
-       ln -s events-poll.c events.c
-
-kqueue:
-       rm -f events.c events.o
-       ln -s events-kqueue.c events.c
-
-epoll:
-       rm -f events.c events.o
-       ln -s events-epoll.c events.c
-
-poll:
-       rm -f events.c events.o
-       ln -s events-poll.c events.c
-
-hooks.c:
-       rm -f hooks.c
-       ln -s hooks-old.c hooks.c
-
-hooks-new:
-       rm -f hooks.c hooks.o ../newserv
-       ln -s hooks-new.c hooks.c
-
-hooks-old:
-       rm -f hooks.c hooks.o ../newserv
-       ln -s hooks-old.c hooks.c
-
 .PHONY: all
-all: events.c main.o events.o schedule.o hooks.o error.o modules.o config.o schedulealloc.o nsmalloc.o
 
+default: all
+
+all: events-${EVENT_ENGINE}.o main.o schedule.o hooks-${HOOK_ENGINE}.o error.o modules.o config.o schedulealloc.o nsmalloc.o
index 83e759bf41aadae4ed8f5e7e8f310cd9dcae61f8..fa0c91670fbce3d85aedf79c8a4970a98fcaf373 100644 (file)
@@ -1 +1,7 @@
+# copy these into settings.mk, do NOT alter here
+EVENT_ENGINE=poll
 NEWSEARCH_NEWPARSER=0
+USE_VALGRIND=0
+SSTRING_NEW=0
+SSTRING_MMAP=0
+HOOKS_NEW=0
index 9f33e1bdefe49cc511f3ec4c55b53ddc67149d6e..e5a5e54ce6cedb3c47a1ea231bb7f8052a639161 100644 (file)
@@ -1,25 +1,7 @@
 @include@ @includel@../build.mk@includel@
 
-.PHONY: sstring-new sstring-old
+.PHONY: all
 
 default: all
 
-sstring.c:
-       rm -f sstring.c sstring.h
-       ln -s sstring-old.h sstring.h
-       ln -s sstring-old.c sstring.c
-
-sstring-new:
-       rm -f sstring.c sstring.h
-       ln -s sstring-new.h sstring.h
-       ln -s sstring-new.c sstring.c
-       @echo "WARNING: you must recompile newserv from scratch to use a different string library (make clean)"
-
-sstring-old:
-       rm -f sstring.c sstring.h
-       ln -s sstring-old.h sstring.h
-       ln -s sstring-old.c sstring.c
-       @echo "WARNING: you must recompile newserv from scratch to use a different string library (make clean)"
-
-.PHONY: all
-all: sstring.o array.o splitline.o base64.o flags.o irc_string.o strlfunc.o sha1.o irc_ipv6.o rijndael.o sha2.o hmac.o prng.o md5.o stringbuf.o
+all: sstring-${SSTRING_ENGINE}.o array.o splitline.o base64.o flags.o irc_string.o strlfunc.o sha1.o irc_ipv6.o rijndael.o sha2.o hmac.o prng.o md5.o stringbuf.o sstring-lib.o
diff --git a/lib/sstring b/lib/sstring
deleted file mode 100644 (file)
index eb5f25d..0000000
Binary files a/lib/sstring and /dev/null differ
diff --git a/lib/sstring-new.h b/lib/sstring-new.h
deleted file mode 100644 (file)
index a0bc0d4..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* sstring.h - Declaration of "static strings" functions */
-
-#ifndef __SSTRING_H 
-#define __SSTRING_H
-
-/* Externally visibly max string length */
-#define SSTRING_MAX    512
-
-/* you can actually change USE_VALGRIND here without recompiling! */
-typedef struct sstring {
-  short length;
-  short alloc;
-  struct sstring *next;
-#ifdef USE_VALGRIND
-  void *block;
-#endif
-  unsigned long refcount;
-  char content[];
-} sstring;
-
-#ifdef COMPILING_SSTRING
-
-/* Internal defines */
-
-/* SSTRING_MAXLEN is the internal version of SSTRING_MAX which includes
- * space for the trailing NUL */
-#define SSTRING_MAXLEN      (SSTRING_MAX + 1)
-#define SSTRING_SLACK       8
-#define SSTRING_ALLOC       16384
-
-#define SSTRING_HASHSIZE    85243
-
-#endif /* COMPILING_SSTRING */
-
-sstring *getsstring(const char *, int);
-void freesstring(sstring *);
-int sstringcompare(sstring *ss1, sstring *ss2);
-void initsstring();
-void finisstring();
-
-#endif /* __SSTRING_H */
diff --git a/lib/sstring-old.h b/lib/sstring-old.h
deleted file mode 100644 (file)
index 22f23c6..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* sstring.h - Declaration of "static strings" functions */
-
-#ifndef __SSTRING_H 
-#define __SSTRING_H
-
-/* Externally visibly max string length */
-#define SSTRING_MAX    512
-
-#ifdef COMPILING_SSTRING
-/* Internal version of structure */
-typedef struct {
-  char *content;
-  union {
-    struct {
-      short length;
-      short alloc;
-    } l;
-    void *next;
-  } u;
-} sstring;
-
-/* Internal defines */
-
-/* SSTRING_MAXLEN is the internal version of SSTRING_MAX which includes
- * space for the trailing NUL */
-#define SSTRING_MAXLEN      (SSTRING_MAX + 1)
-#define SSTRING_SLACK       8
-#define SSTRING_STRUCTALLOC 4096
-#define SSTRING_DATAALLOC   4096
-
-#else
-/* External (simpler) version */
-
-typedef struct {
-  char *content;
-  short length;
-} sstring;
-
-#endif /* COMPILING_SSTRING */
-
-sstring *getsstring(const char *, int);
-void freesstring(sstring *);
-int sstringcompare(sstring *ss1, sstring *ss2);
-void initsstring();
-void finisstring();
-
-#endif /* __SSTRING_H */
index a5595b4f3d8e0c52663dfa9113754a79fbc2fc49..2844b369c73b7bee4fa7453ff610276ed4ebcffa 100644 (file)
@@ -3,16 +3,13 @@
 CFLAGS+=$(INCPCRE)
 LDFLAGS+=$(LIBPCRE)
 
-@if@ ${NEWSEARCH_NEWPARSER} == 1
-CFLAGS+=-DNEWSEARCH_NEWPARSER=1
-@endif@
-
-NSCOMMANDS=ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o ns-kill.o ns-gline.o ns-exists.o ns-services.o ns-size.o ns-name.o ns-topic.o ns-oppct.o ns-cumodecount.o ns-cumodepct.o ns-hostpct.o ns-authedpct.o ns-length.o ns-kick.o ns-authts.o ns-channels.o ns-server.o ns-authid.o ns-notice.o newsearch_ast.o ns-any.o ns-channeliter.o ns-var.o ns-all.o ns-cumodes.o ns-cidr.o ns-nickiter.o
-
 .PHONY: all clean distclean
 all: newsearch.so
 
-@if@ ${NEWSEARCH_NEWPARSER} == 1
+NSCOMMANDS=ns-not.o ns-and.o ns-or.o ns-eq.o ns-match.o ns-hostmask.o ns-realname.o ns-modes.o ns-nick.o ns-ident.o ns-regex.o ns-host.o ns-channel.o ns-lt.o ns-gt.o ns-timestamp.o ns-country.o ns-authname.o ns-ip.o ns-kill.o ns-gline.o ns-exists.o ns-services.o ns-size.o ns-name.o ns-topic.o ns-oppct.o ns-cumodecount.o ns-cumodepct.o ns-hostpct.o ns-authedpct.o ns-length.o ns-kick.o ns-authts.o ns-channels.o ns-server.o ns-authid.o ns-notice.o newsearch_ast.o ns-any.o ns-channeliter.o ns-var.o ns-all.o ns-cumodes.o ns-cidr.o ns-nickiter.o
+
+@ifeq@${NEWSEARCH_NEWPARSER}@ifeqsep@1@ifeqend@
+CFLAGS+=-DNEWSEARCH_NEWPARSER=1
 newsearch.so: newsearch.o formats.o y.tab.o lex.yy.o parser.o ${NSCOMMANDS}
 @else@
 newsearch.so: newsearch.o formats.o ${NSCOMMANDS}