X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Ftemplate%2Fmain.mk;h=c2babe8f6c5c74c67a704d65bfd6d0f38528e809;hb=fff28e7ff0cd33935e64901678941f3592537608;hp=e2688cefa3cdffd6b45b3a3912fdab895fc92aca;hpb=c6140ba7048e0e1bc11bd827639953742d03e380;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/template/main.mk b/make/template/main.mk index e2688cefa..c2babe8f6 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -1,8 +1,29 @@ +%target BSD_MAKE BSDmakefile +%target GNU_MAKE GNUmakefile +# +# InspIRCd -- Internet Relay Chat Daemon +# +# Copyright (C) 2009-2010 Daniel De Graaf +# +# 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 . +# + + +# # InspIRCd Main Makefile # -# (C) InspIRCd Development Team, 2002-2009 # This file is automagically generated by configure, from -# make/templates/main.mk. Any changes make to the generated +# make/template/main.mk. Any changes made to the generated # files will go away whenever it is regenerated! # # Please do not edit unless you know what you're doing. This @@ -10,101 +31,133 @@ # them by configure. # -CC = @CC@ -SYSTEM = @SYSTEM@ -BUILDPATH = @BUILD_DIR@ + +CXX = @CXX@ +COMPILER = @COMPILER_NAME@ +SYSTEM = @SYSTEM_NAME@ +BUILDPATH ?= $(PWD)/build SOCKETENGINE = @SOCKETENGINE@ -CXXFLAGS = -O1 -pipe -fPIC -DPIC -LDLIBS = -pthread -lstdc++ -LDFLAGS = -SHARED = -shared -rdynamic +CORECXXFLAGS = -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -pipe -Iinclude -Wall -Wextra -Wfatal-errors -Wno-unused-parameter -Wshadow +LDLIBS = -lstdc++ CORELDFLAGS = -rdynamic -L. $(LDFLAGS) PICLDFLAGS = -fPIC -shared -rdynamic $(LDFLAGS) -BASE = "@BASE_DIR@" -CONPATH = "@CONFIG_DIR@" -MODPATH = "@MODULE_DIR@" -BINPATH = "@BINARY_DIR@" -LAUNCHDPATH = "/System/Library/LaunchDaemons" -INSTMODE = 0755 - -@IFEQ $(CC) icc - CXXFLAGS += -Wshadow -@ELSE - CXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall +BASE = "$(DESTDIR)@BASE_DIR@" +CONPATH = "$(DESTDIR)@CONFIG_DIR@" +MANPATH = "$(DESTDIR)@MANUAL_DIR@" +MODPATH = "$(DESTDIR)@MODULE_DIR@" +LOGPATH = "$(DESTDIR)@LOG_DIR@" +DATPATH = "$(DESTDIR)@DATA_DIR@" +BINPATH = "$(DESTDIR)@BINARY_DIR@" +INSTALL = install +INSTUID = @UID@ +INSTMODE_DIR = 0750 +INSTMODE_BIN = 0750 +INSTMODE_LIB = 0640 + +@IFNEQ $(COMPILER) ICC + CORECXXFLAGS += -Woverloaded-virtual -Wshadow +@IFNEQ $(SYSTEM) openbsd + CORECXXFLAGS += -pedantic -Wformat=2 -Wmissing-format-attribute +@ENDIF @ENDIF +@IFNEQ $(SYSTEM) darwin + LDLIBS += -pthread +@ENDIF @IFEQ $(SYSTEM) linux - LDLIBS += -ldl -@ELSIFEQ $(SYSTEM) solaris - LDLIBS += -lsocket -lnsl -lrt -lresolv -@ELSIFEQ $(SYSTEM) sunos + LDLIBS += -ldl -lrt +@ENDIF +@IFEQ $(SYSTEM) gnukfreebsd + LDLIBS += -ldl -lrt +@ENDIF +@IFEQ $(SYSTEM) gnu + LDLIBS += -ldl -lrt +@ENDIF +@IFEQ $(SYSTEM) solaris LDLIBS += -lsocket -lnsl -lrt -lresolv -@ELSIFEQ $(SYSTEM) darwin - CXXFLAGS += -DDARWIN -frtti + INSTALL = ginstall +@ENDIF +@IFEQ $(SYSTEM) darwin LDLIBS += -ldl - SHARED = -bundle -twolevel_namespace -undefined dynamic_lookup - CORELDFLAGS = -dynamic -bind_at_load -L. -@ELSIFEQ $(SYSTEM) interix - CXXFLAGS += -D_ALL_SOURCE -I/usr/local/include -@ENDIF - -@IFDEF D - CXXFLAGS += -g3 -Werror - HEADER = debug-header -@ELSE - CXXFLAGS += -g1 - HEADER = std-header + CORELDFLAGS = -dynamic -bind_at_load -L. $(LDFLAGS) + PICLDFLAGS = -fPIC -shared -twolevel_namespace -undefined dynamic_lookup $(LDFLAGS) @ENDIF -FOOTER = finishmessage -CXXFLAGS += -Iinclude +@IFNDEF INSPIRCD_DEBUG + INSPIRCD_DEBUG=0 +@ENDIF -@GNU_ONLY MAKEFLAGS += --no-print-directory +DBGOK=0 +@IFEQ $(INSPIRCD_DEBUG) 0 + CORECXXFLAGS += -fno-rtti -O2 +@IFEQ $(COMPILER) GCC + CORECXXFLAGS += -g1 +@ENDIF + HEADER = std-header + DBGOK=1 +@ENDIF +@IFEQ $(INSPIRCD_DEBUG) 1 + CORECXXFLAGS += -O0 -g3 -Werror -DINSPIRCD_ENABLE_RTTI + HEADER = debug-header + DBGOK=1 +@ENDIF +@IFEQ $(INSPIRCD_DEBUG) 2 + CORECXXFLAGS += -fno-rtti -O2 -g3 + HEADER = debug-header + DBGOK=1 +@ENDIF +FOOTER = finishmessage -@GNU_ONLY SOURCEPATH = $(shell /bin/pwd) -@BSD_ONLY SOURCEPATH != /bin/pwd +@TARGET GNU_MAKE MAKEFLAGS += --no-print-directory -@IFDEF V - RUNCC = $(CC) - VERBOSE = -v -@ELSE - @GNU_ONLY MAKEFLAGS += --silent - @BSD_ONLY MAKE += -s - RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CC) +@TARGET GNU_MAKE SOURCEPATH = $(shell /bin/pwd) +@TARGET BSD_MAKE SOURCEPATH != /bin/pwd + +@IFNDEF INSPIRCD_VERBOSE + @TARGET GNU_MAKE MAKEFLAGS += --silent + @TARGET BSD_MAKE MAKE += -s @ENDIF -@IFDEF PURE_STATIC - CXXFLAGS += -DPURE_STATIC +@IFDEF INSPIRCD_STATIC + CORECXXFLAGS += -DINSPIRCD_STATIC @ENDIF -@DO_EXPORT RUNCC CXXFLAGS CC LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS PURE_STATIC -@DO_EXPORT BASE CONPATH MODPATH BINPATH SOURCEPATH BUILDPATH +# Add the users CPPFLAGS/CXXFLAGS to the base ones to allow them to +# override things like -Wfatal-errors if they wish to. +CORECXXFLAGS += $(CPPFLAGS) $(CXXFLAGS) + +@DO_EXPORT CXX CORECXXFLAGS LDLIBS PICLDFLAGS INSPIRCD_VERBOSE SOCKETENGINE CORELDFLAGS +@DO_EXPORT SOURCEPATH BUILDPATH INSPIRCD_STATIC # Default target TARGET = all -@IFDEF M +@IFDEF INSPIRCD_MODULE 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/${INSPIRCD_MODULE:S/.so$//}.so + @TARGET GNU_MAKE TARGET = modules/$(INSPIRCD_MODULE:.so=).so @ENDIF -@IFDEF T +@IFDEF INSPIRCD_TARGET HEADER = FOOTER = target - TARGET = $(T) + TARGET = $(INSPIRCD_TARGET) +@ENDIF + +@IFEQ $(DBGOK) 0 + HEADER = unknown-debug-level @ENDIF all: $(FOOTER) target: $(HEADER) $(MAKEENV) perl make/calcdep.pl - cd $(BUILDPATH); $(MAKEENV) $(MAKE) -f real.mk $(TARGET) + cd "$(BUILDPATH)"; $(MAKEENV) $(MAKE) -f real.mk $(TARGET) debug: - @${MAKE} D=1 all + @${MAKE} INSPIRCD_DEBUG=1 all debug-header: @echo "*************************************" @@ -121,6 +174,10 @@ debug-header: @echo "*************************************" mod-header: +@IFDEF INSPIRCD_STATIC + @echo 'Cannot build single modules in pure-static build' + @exit 1 +@ENDIF @echo 'Building single module:' mod-footer: target @@ -146,65 +203,91 @@ finishmessage: target @echo "* make install *" @echo "*************************************" -install: target@EXTRA_DIR@ - @-install -d -m $(INSTMODE) $(BASE) - @-install -d -m $(INSTMODE) $(BASE)/data - @-install -d -m $(INSTMODE) $(BASE)/logs - @-install -d -m $(INSTMODE) $(BINPATH) - @-install -d -m $(INSTMODE) $(CONPATH) - @-install -d -m $(INSTMODE) $(MODPATH) - -install -m $(INSTMODE) $(BUILDPATH)/modules/*.so $(MODPATH) - -install -m $(INSTMODE) $(BUILDPATH)/bin/inspircd $(BINPATH) - -install -m $(INSTMODE) @STARTSCRIPT@ $(@DESTINATION@) 2>/dev/null - @$(MAKEENV) make/install-extras.pl install +install: target + @if [ "$(INSTUID)" = 0 -o "$(INSTUID)" = root ]; then \ + echo ""; \ + echo "Error: You must specify a non-root UID for the server"; \ + echo ""; \ + echo "If you are making a package, please specify using ./configure --uid"; \ + echo "Otherwise, rerun using 'make INSTUID=irc install', where 'irc' is the user"; \ + echo "who will be running the ircd. You will also need to modify the start script."; \ + echo ""; \ + exit 1; \ + fi + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(BASE) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(DATPATH) + @-$(INSTALL) -d -o $(INSTUID) -m $(INSTMODE_DIR) $(LOGPATH) + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(BINPATH) + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/aliases + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(CONPATH)/examples/modules + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MANPATH) + @-$(INSTALL) -d -m $(INSTMODE_DIR) $(MODPATH) + [ "$(BUILDPATH)/bin/" -ef $(BINPATH) ] || $(INSTALL) -m $(INSTMODE_BIN) "$(BUILDPATH)/bin/inspircd" $(BINPATH) +@IFNDEF INSPIRCD_STATIC + [ "$(BUILDPATH)/modules/" -ef $(MODPATH) ] || $(INSTALL) -m $(INSTMODE_LIB) "$(BUILDPATH)/modules/"*.so $(MODPATH) +@ENDIF + -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/inspircd $(BASE) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) .gdbargs $(BASE)/.gdbargs 2>/dev/null +@IFEQ $(SYSTEM) darwin + -$(INSTALL) -m $(INSTMODE_BIN) @CONFIGURE_DIRECTORY@/org.inspircd.plist $(BASE) 2>/dev/null +@ENDIF +@IFEQ $(SYSTEM) linux + -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.service $(BASE) 2>/dev/null +@ENDIF + -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd.1 $(MANPATH) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) @CONFIGURE_DIRECTORY@/inspircd-genssl.1 $(MANPATH) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_BIN) tools/genssl $(BINPATH)/inspircd-genssl 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/*.example $(CONPATH)/examples + -$(INSTALL) -m $(INSTMODE_LIB) *.pem $(CONPATH) 2>/dev/null + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/aliases/*.example $(CONPATH)/examples/aliases + -$(INSTALL) -m $(INSTMODE_LIB) docs/conf/modules/*.example $(CONPATH)/examples/modules @echo "" @echo "*************************************" @echo "* INSTALL COMPLETE! *" - @echo "* *" - @echo "* It is safe to ignore any messages *" - @echo "* related to copying of conf files. *" - @echo "* *" - @echo "* REMEMBER TO EDIT YOUR CONFIG FILE *" @echo "*************************************" - -@GNU_ONLY RCS_FILES = $(wildcard .git/index .svn/entries .config.cache) -@GNU_ONLY GNUmakefile: make/template/main.mk configure $(RCS_FILES) -@GNU_ONLY ./configure -update + @echo 'Paths:' + @echo ' Base install:' $(BASE) + @echo ' Configuration:' $(CONPATH) + @echo ' Binaries:' $(BINPATH) + @echo ' Modules:' $(MODPATH) + @echo ' Data:' $(DATPATH) + @echo 'To start the ircd, run:' $(BASE)/inspircd start + @echo 'Remember to create your config file:' $(CONPATH)/inspircd.conf + @echo 'Examples are available at:' $(CONPATH)/examples/ + +GNUmakefile BSDmakefile: make/template/main.mk src/version.sh configure @CONFIGURE_CACHE_FILE@ + ./configure --update +@TARGET BSD_MAKE .MAKEFILEDEPS: BSDmakefile clean: @echo Cleaning... - @-rm -f src/inspircd src/modes/modeclasses.a include/inspircd_se_config.h - @-rm -f src/*.so src/modules/*.so src/commands/*.so - @-rm -f src/*.o src/*/*.o src/modules/*/*.o - @-rm -f src/.*.d src/*/.*.d src/modules/*/.*.d - @-rm -f $(BUILDPATH)/bin/inspircd $(BUILDPATH)/include $(BUILDPATH)/real.mk - @-rm -rf $(BUILDPATH)/obj $(BUILDPATH)/modules - @-rmdir $(BUILDPATH)/bin 2>/dev/null - @-rmdir $(BUILDPATH) 2>/dev/null + -rm -f "$(BUILDPATH)/bin/inspircd" "$(BUILDPATH)/include" "$(BUILDPATH)/real.mk" + -rm -rf "$(BUILDPATH)/obj" "$(BUILDPATH)/modules" + @-rmdir "$(BUILDPATH)/bin" 2>/dev/null + @-rmdir "$(BUILDPATH)" 2>/dev/null @echo Completed. deinstall: - -rm $(BINPATH)/inspircd - -rm $(MODPATH)/*.so - @make/install-extras.pl deinstall - -squeakyclean: distclean - -launchd_dir: - @-install -d -m $(INSTMODE) ${LAUNCHDPATH} + -rm -f $(BINPATH)/inspircd + -rm -rf $(CONPATH)/examples + -rm -f $(MANPATH)/inspircd.1 + -rm -f $(MANPATH)/inspircd-genssl.1 + -rm -f $(MODPATH)/m_*.so + -rm -f $(MODPATH)/core_*.so + -rm -f $(BASE)/.gdbargs + -rm -f $(BASE)/inspircd.service + -rm -f $(BASE)/org.inspircd.plist configureclean: - rm -f .config.cache - rm -f src/modules/Makefile - rm -f src/commands/Makefile - rm -f src/Makefile - -rm -f Makefile + rm -f .gdbargs rm -f BSDmakefile rm -f GNUmakefile - rm -f include/inspircd_config.h - rm -f include/inspircd_version.h + rm -f include/config.h + rm -rf @CONFIGURE_DIRECTORY@ distclean: clean configureclean + -rm -rf "$(SOURCEPATH)/run" + find "$(SOURCEPATH)/src/modules" -type l | xargs rm -f help: @echo 'InspIRCd Makefile' @@ -212,25 +295,28 @@ help: @echo 'Use: ${MAKE} [flags] [targets]' @echo '' @echo 'Flags:' - @echo ' V=1 Show the full command being executed instead of "BUILD: dns.cpp"' - @echo ' D=1 Enable debug build, for module development or crash tracing' - @echo ' -j Run a parallel build using N jobs' + @echo ' INSPIRCD_VERBOSE=1 Show the full command being executed instead of "BUILD: dns.cpp"' + @echo ' INSPIRCD_DEBUG=1 Enable debug build, for module development or crash tracing' + @echo ' INSPIRCD_DEBUG=2 Enable debug build with optimizations, for detailed backtraces' + @echo ' DESTDIR= Specify a destination root directory (for tarball creation)' + @echo ' -j Run a parallel build using N jobs' @echo '' - @echo 'User targets:' - @echo ' all Complete build of InspIRCd, without installing' + @echo 'Targets:' + @echo ' all Complete build of InspIRCd, without installing (default)' @echo ' install Build and install InspIRCd to the directory chosen in ./configure' @echo ' Currently installs to ${BASE}' @echo ' debug Compile a debug build. Equivalent to "make D=1 all"' @echo '' - @echo ' M=m_foo Builds a single module (cmd_foo also works here)' - @echo ' T=target Builds a user-specified target, such as "inspircd" or "modules"' - @echo ' Other targets are specified by their path in the build directory' - @echo ' Multiple targets may be separated by a space' + @echo ' INSPIRCD_MODULE=m_foo Builds a single module (core_foo also works here)' + @echo ' INSPIRCD_TARGET=target Builds a user-specified target, such as "inspircd" or "modules"' + @echo ' Other targets are specified by their path in the build directory' + @echo ' Multiple targets may be separated by a space' @echo '' @echo ' clean Cleans object files produced by the compile' - @echo ' distclean Cleans all files produced by compile and ./configure' - @echo ' Note: this includes the Makefile' + @echo ' distclean Cleans all generated files (build, configure, run, etc)' @echo ' deinstall Removes the files created by "make install"' @echo -.PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall squeakyclean launchd_dir configureclean help +.NOTPARALLEL: + +.PHONY: all target debug debug-header mod-header mod-footer std-header finishmessage install clean deinstall configureclean help