diff options
author | Peter Powell <petpow@saberuk.com> | 2014-04-14 12:42:22 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-05-23 14:13:51 +0200 |
commit | e6d245a3e80c0e0c05476e5bd9c45a77e16fecec (patch) | |
tree | 490b8e34f3bd0f9b85959782a1760e2c7e55fcea /make/template | |
parent | b512f1b9667ca0479d42e771082f3bc8d92c63a2 (diff) |
Replace the configure templating system with something better.
A large amount of this code can be removed when buildtool is done
as we will not need to worry about the differences between BSD and
GNU Make.
Diffstat (limited to 'make/template')
-rw-r--r-- | make/template/config.h | 38 | ||||
-rw-r--r-- | make/template/gdbargs | 4 | ||||
-rw-r--r-- | make/template/inspircd | 3 | ||||
-rw-r--r-- | make/template/main.mk | 30 | ||||
-rw-r--r-- | make/template/org.inspircd.plist | 1 |
5 files changed, 61 insertions, 15 deletions
diff --git a/make/template/config.h b/make/template/config.h new file mode 100644 index 000000000..6aa593975 --- /dev/null +++ b/make/template/config.h @@ -0,0 +1,38 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2014 Peter Powell <petpow@saberuk.com> + * + * This file is part of InspIRCd. InspIRCd is free software: you can + * redistribute it and/or modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +#pragma once + +#define BRANCH "InspIRCd-@VERSION_MAJOR@.@VERSION_MINOR@" +#define VERSION "InspIRCd-@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@" +#define REVISION "@VERSION_LABEL@" +#define SYSTEM "@SYSTEM_NAME_VERSION@" + +#define CONFIG_PATH "@CONFIG_DIR@" +#define DATA_PATH "@DATA_DIR@" +#define LOG_PATH "@LOG_DIR@" +#define MOD_PATH "@MODULE_DIR@" + +#define INSPIRCD_SOCKETENGINE_NAME "@SOCKETENGINE@" + +#ifndef _WIN32 + %target include/config.h + %define HAS_CLOCK_GETTIME + %define HAS_EVENTFD +#endif diff --git a/make/template/gdbargs b/make/template/gdbargs new file mode 100644 index 000000000..de76c7270 --- /dev/null +++ b/make/template/gdbargs @@ -0,0 +1,4 @@ +%target .gdbargs +handle SIGPIPE pass nostop noprint +handle SIGHUP pass nostop noprint +run diff --git a/make/template/inspircd b/make/template/inspircd index c14099323..7610557b8 100644 --- a/make/template/inspircd +++ b/make/template/inspircd @@ -1,3 +1,4 @@ +%mode 0750 #!/usr/bin/env perl # @@ -30,7 +31,7 @@ my $runpath = "@BASE_DIR@"; my $datadir = "@DATA_DIR@"; my $valgrindlogpath = "$basepath/valgrindlogs"; my $executable = "inspircd"; -my $version = "@VERSION@"; +my $version = "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@+@VERSION_LABEL@"; my $uid = "@UID@"; if (!("--runasroot" ~~ @ARGV) && ($< == 0 || $> == 0)) { diff --git a/make/template/main.mk b/make/template/main.mk index e0018d728..9a8853021 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -1,3 +1,5 @@ +%target BSD_MAKE BSDmakefile +%target GNU_MAKE GNUmakefile # # InspIRCd -- Internet Relay Chat Daemon # @@ -31,8 +33,8 @@ CXX = @CXX@ -COMPILER = @COMPILER@ -SYSTEM = @SYSTEM@ +COMPILER = @COMPILER_NAME@ +SYSTEM = @SYSTEM_NAME@ BUILDPATH ?= $(PWD)/build SOCKETENGINE = @SOCKETENGINE@ CORECXXFLAGS = -fPIC -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow @@ -50,11 +52,11 @@ INSTMODE_DIR = 0750 INSTMODE_BIN = 0750 INSTMODE_LIB = 0640 -@IFNEQ $(COMPILER) icc +@IFNEQ $(COMPILER) ICC CORECXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute @ENDIF -@IFNEQ $(SYSTEM)-$(COMPILER) darwin-gcc +@IFNEQ $(SYSTEM)-$(COMPILER) darwin-GCC CORECXXFLAGS += -fvisibility=hidden @ENDIF @@ -88,7 +90,7 @@ INSTMODE_LIB = 0640 DBGOK=0 @IFEQ $(D) 0 CORECXXFLAGS += -O2 -@IFEQ $(CXX) g++ +@IFEQ $(COMPILER) GCC CORECXXFLAGS += -g1 @ENDIF HEADER = std-header @@ -106,18 +108,18 @@ DBGOK=0 @ENDIF FOOTER = finishmessage -@GNU_ONLY MAKEFLAGS += --no-print-directory +@TARGET GNU_MAKE MAKEFLAGS += --no-print-directory -@GNU_ONLY SOURCEPATH = $(shell /bin/pwd) -@BSD_ONLY SOURCEPATH != /bin/pwd +@TARGET GNU_MAKE SOURCEPATH = $(shell /bin/pwd) +@TARGET BSD_MAKE SOURCEPATH != /bin/pwd @IFDEF V RUNCC = $(CXX) RUNLD = $(CXX) VERBOSE = -v @ELSE - @GNU_ONLY MAKEFLAGS += --silent - @BSD_ONLY MAKE += -s + @TARGET GNU_MAKE MAKEFLAGS += --silent + @TARGET BSD_MAKE MAKE += -s RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CXX) RUNLD = perl $(SOURCEPATH)/make/run-cc.pl $(CXX) @ENDIF @@ -139,8 +141,8 @@ TARGET = all @IFDEF M HEADER = mod-header FOOTER = mod-footer - @BSD_ONLY TARGET = modules/${M:S/.so$//}.so - @GNU_ONLY TARGET = modules/$(M:.so=).so + @TARGET BSD_MAKE TARGET = modules/${M:S/.so$//}.so + @TARGET GNU_MAKE TARGET = modules/$(M:.so=).so @ENDIF @IFDEF T @@ -229,11 +231,11 @@ install: target [ $(BUILDPATH)/modules/ -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) $(BUILDPATH)/modules/*.so $(MODPATH) @ENDIF -$(INSTALL) -m $(INSTMODE_BIN) inspircd $(BASE) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null @IFEQ $(SYSTEM) darwin -$(INSTALL) -m $(INSTMODE_BIN) org.inspircd.plist $(BASE) 2>/dev/null @ENDIF -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null - -$(INSTALL) -m $(INSTMODE_LIB) tools/gdbargs $(BASE)/.gdbargs 2>/dev/null -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules @@ -253,7 +255,7 @@ install: target GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure .config.cache ./configure -update -@BSD_ONLY .MAKEFILEDEPS: BSDmakefile +@TARGET BSD_MAKE .MAKEFILEDEPS: BSDmakefile clean: @echo Cleaning... diff --git a/make/template/org.inspircd.plist b/make/template/org.inspircd.plist index 1a5ba5b62..ef5ef199b 100644 --- a/make/template/org.inspircd.plist +++ b/make/template/org.inspircd.plist @@ -1,3 +1,4 @@ +%platform darwin <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> |