X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=.Makefile.inc;h=526779d801821475fced72004b45d335f45ff468;hb=de25d946733f774e3a5b53a58438a9c92af0acbe;hp=348051af9a8438f5f9b6db49fbc0ee2bda1b47f1;hpb=3954761f11af50ed33b88f1e6609bfa8a5dab750;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/.Makefile.inc b/.Makefile.inc index 348051af9..526779d80 100644 --- a/.Makefile.inc +++ b/.Makefile.inc @@ -1,41 +1,99 @@ -# InspIRCd Main Makefile +# InspIRCd Main Makefile # -# (C) InspIRCd Development Team, 2002-2009 +# (C) InspIRCd Development Team, 2002-2009 # This file is automagically generated by configure, from -# .Makefile.inc. Any changes made will go away! :P -# Please do not edit unless you know what you're doing. +# .Makefile.inc. Any changes make will go away! +# Please do not edit unless you know what you're doing. # -ifdef D - ifeq ("$(origin D)", "command line") - NICEFLAGS = @DEVELOPER@ - HEADER = debug-header - endif -endif - -ifndef NICEFLAGS - NICEFLAGS = @FLAGS@ -endif - -ifndef HEADER - HEADER = std-header -endif - CC = @CC@ -FLAGS = $(NICEFLAGS) -pedantic -LDLIBS = @LDLIBS@ +SYSTEM = @SYSTEM@ +BUILDPATH = @BUILD_DIR@ +SOCKETENGINE = @SOCKETENGINE@ +CXXFLAGS += -pipe -fPIC -DPIC +LDLIBS = -pthread -lstdc++ +LDFLAGS = +SHARED = -shared -rdynamic +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" -LIBPATH = "@LIBRARY_DIR@" -MODULES = @MODULES@ INSTMODE = 0755 -MAKEFLAGS += --no-print-directory -s -export FLAGS NICEFLAGS CC LDLIBS MODULES MODPATH LIBPATH INSTMODE -all: ircd mods finishmessage +@IFEQ $(CC) icc + CXXFLAGS += -Wshadow +@ELSE + CXXFLAGS += -pedantic -Woverloaded-virtual -Wshadow -Wformat=2 -Wmissing-format-attribute -Wall +@ENDIF + + +@IFEQ $(SYSTEM) linux + LDLIBS += -ldl +@ELSIFEQ $(SYSTEM) solaris + LDLIBS += -lsocket -lnsl -lrt -lresolv +@ELSIFEQ $(SYSTEM) sunos + LDLIBS += -lsocket -lnsl -lrt -lresolv +@ELSIFEQ $(SYSTEM) darwin + CXXFLAGS += -DDARWIN -frtti + 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 +@ENDIF +FOOTER = finishmessage + +CXXFLAGS += -Iinclude + +@GNU_ONLY MAKEFLAGS += --no-print-directory + +@GNU_ONLY SOURCEPATH = $(shell /bin/pwd) +@BSD_ONLY SOURCEPATH != /bin/pwd + +@IFDEF V + RUNCC = $(CC) + VERBOSE = -v +@ELSE + @GNU_ONLY MAKEFLAGS += --silent + @BSD_ONLY MAKE += -s + RUNCC = perl $(SOURCEPATH)/make/run-cc.pl $(CC) +@ENDIF + +@DO_EXPORT RUNCC CXXFLAGS CC LDLIBS PICLDFLAGS VERBOSE SOCKETENGINE CORELDFLAGS +@DO_EXPORT BASE CONPATH MODPATH BINPATH SOURCEPATH BUILDPATH + +# Default target +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 +@ENDIF + +@IFDEF T + HEADER = + FOOTER = target + TARGET = $(T) +@ENDIF + +all: $(FOOTER) + +target: $(HEADER) + $(MAKEENV) perl make/calcdep.pl + $(MAKEENV) $(MAKE) -C $(BUILDPATH) -f real.mk $(TARGET) debug: @${MAKE} D=1 all @@ -54,6 +112,13 @@ debug-header: @echo "* *" @echo "*************************************" +mod-header: + @echo 'Building single module:' + +mod-footer: target + @echo 'To install, copy $(BUILDPATH)/$(TARGET) to $(MODPATH)' + @echo 'Or, run "make install"' + std-header: @echo "*************************************" @echo "* BUILDING INSPIRCD *" @@ -64,14 +129,7 @@ std-header: @echo "* while you wait for make to run? *" @echo "*************************************" -ircd: $(HEADER) - @${MAKE} -C src $(MAKEARGS) inspircd commands - -mods: $(HEADER) - @${MAKE} -C src/modules $(MAKEARGS) - -# Make this depend on 'ircd' and 'mods', so its always output last even with -j -finishmessage: ircd mods +finishmessage: target @echo "" @echo "*************************************" @echo "* BUILD COMPLETE! *" @@ -80,14 +138,16 @@ finishmessage: ircd mods @echo "* make install *" @echo "*************************************" -install: ircd mods@EXTRA_DIR@ +install: target@EXTRA_DIR@ @-install -d -m $(INSTMODE) $(BASE) - @-install -d -m $(INSTMODE) $(LIBPATH) @-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 -@INSTALL_LIST@ @echo "" + @$(MAKEENV) make/install-extras.pl install + @echo "" @echo "*************************************" @echo "* INSTALL COMPLETE! *" @echo "* *" @@ -97,25 +157,26 @@ install: ircd mods@EXTRA_DIR@ @echo "* REMEMBER TO EDIT YOUR CONFIG FILE *" @echo "*************************************" -module: - @${MAKE} -C src/modules $(MAKEARGS) ${name} +@GNU_ONLY RCS_FILES = $(wildcard .git/index .svn/entries) +@GNU_ONLY GNUmakefile: .Makefile.inc configure .config.cache $(RCS_FILES) +@GNU_ONLY ./configure -update clean: @echo Cleaning... - @rm -rf src/*.so src/*.dylib src/*.o src/inspircd src/modules/*.so src/modules/*.o *~ src/*~ src/modules/*~ src/modules/extra/*~ src/modes/*~ src/modes/*.o src/modes/*.a src/commands/*.so src/commands/*.o src/modules/*/*.o src/modules/*/*.so src/socketengines/*.o + @-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 @echo Completed. -modclean: - rm -rf modules/*.so - rm -rf src/modules/*.so - rm -rf src/modules/*.o - rm -rf src/modules/*/*.so - rm -rf src/modules/*/*.o - rm -rf lib/*.so - rm -f bin/inspircd - deinstall: -@UNINSTALL_LIST@ + -rm $(BINPATH)/inspircd + -rm $(MODPATH)/*.so + @make/install-extras.pl deinstall squeakyclean: distclean @@ -127,9 +188,39 @@ configureclean: rm -f src/modules/Makefile rm -f src/commands/Makefile rm -f src/Makefile - rm -f Makefile + -rm -f Makefile + rm -f BSDmakefile + rm -f GNUmakefile rm -f include/inspircd_config.h - rm -f include/inspircd_se_config.h - -distclean: modclean clean configureclean - + rm -f include/inspircd_version.h + +distclean: clean configureclean + +help: + @echo 'InspIRCd Makefile' + @echo '' + @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 '' + @echo 'User targets:' + @echo ' all Complete build of InspIRCd, without installing' + @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 '' + @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 ' 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