From dacc8d2149f9095d612d95ec8dfcf596681be18b Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 18 May 2010 16:30:11 +0200 Subject: merged makefile system with SMERP --- makefiles/gmake/clean.mk | 5 ++++- makefiles/gmake/compiler.mk | 51 ++++++++++++++++++++++++++++++++++++++----- makefiles/gmake/guess_env | 28 +++++++++++++++++++++++- makefiles/gmake/help.mk | 1 + makefiles/gmake/i18n.mk | 15 +++++++++++-- makefiles/gmake/install.mk | 34 +++++++++++++++++++++++++++++ makefiles/gmake/libs.mk | 53 +++++++++++++++++++++++++++++++++++++++++++++ makefiles/gmake/platform.mk | 9 ++++++++ makefiles/gmake/sub.mk | 5 +++-- makefiles/gmake/top.mk | 7 ++++++ makefiles/nmake/clean.mk | 8 +++++-- makefiles/nmake/compiler.mk | 22 +++++++++++++++++-- makefiles/nmake/config.mk | 44 +++++++++++++++++++++++++++++++++++++ makefiles/nmake/platform.mk | 7 +----- 14 files changed, 268 insertions(+), 21 deletions(-) create mode 100644 makefiles/gmake/libs.mk create mode 100644 makefiles/nmake/config.mk (limited to 'makefiles') diff --git a/makefiles/gmake/clean.mk b/makefiles/gmake/clean.mk index 3c7a8a9..92061d4 100644 --- a/makefiles/gmake/clean.mk +++ b/makefiles/gmake/clean.mk @@ -27,7 +27,10 @@ clean: clean_recursive clean_po local_clean -@rm -f exec/* 2>/dev/null -@rm -f *.core 2>/dev/null -@rm -f $(CMODULES) $(CPPMODULES) 2>/dev/null - -@rm -f $(CMODULES .o=.d) $(CPPMODULES .o=.d) 2>/dev/null + -@rm -f $(CMODULES:.o=.d) $(CPPMODULES:.o=.d) 2>/dev/null + -@rm -rf $(STATIC_LIB) 2>/dev/null + -@rm -rf $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) 2>/dev/null + -@rm -f $(SH_OBJS) rm -f $(SHPP_OBJS) 2>/dev/null .PHONY: distclean_recursive distclean local_distclean diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk index 0962f11..dff1c74 100644 --- a/makefiles/gmake/compiler.mk +++ b/makefiles/gmake/compiler.mk @@ -269,8 +269,47 @@ PTHREADS_LIBS = endif endif -CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS) -CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(PTHREADS_CFLAGS) +# set flags for position independend code (as required for shared libraries +# on some platforms) +ifeq "$(COMPILER)" "gcc" +ifeq "$(PLATFORM)" "LINUX" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "SUNOS" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "FREEBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "NETBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "OPENBSD" +SO_COMPILE_FLAGS = -fPIC +endif +ifeq "$(PLATFORM)" "CYGWIN" +# code on Cygwin is always position independend +SO_COMPILE_FLAGS = +endif +endif + +ifeq "$(COMPILER)" "icc" +ifeq "$(PLATFORM)" "LINUX" +SO_COMPILE_FLAGS = -fPIC +endif +endif + +# TODO: test this +#ifeq "$(COMPILER)" "spro" +#ifeq "$(PLATFORM)" "SUNOS" +#ifeq "$(ARCH)" "sun4u" +#SO_COMPILE_FLAGS = -xcode=pic32 +#endif +#endif +#endif + +CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(INCLUDE_CFLAGS) $(PTHREADS_CFLAGS) +CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(INCLUDE_DIRS) $(INCLUDE_CPPFLAGS) $(PTHREADS_CFLAGS) LDFLAGS = $(INCLUDE_LDFLAGS) $(PTHREADS_LDFLAGS) $(LDFLAGS_NET) $(LDFLAGS_LT) $(LDFLAGS_DL) LIBS = $(INCLUDE_LIBS) $(PTHREADS_LIBS) $(LIBS_NET) $(LIBS_LT) $(LIBS_DL) @@ -284,16 +323,16 @@ CCPP_LINK = $(CCPP) $(CCPP) -c -o $@ $(CCPPFLAGS) $< %$(EXE): %.o $(OBJS) $(TEST_OBJS) - $(LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS) + $(CCPP_LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS) %.sho : %.c - $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $< + $(CC) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CFLAGS) $< %$(SO) : %.sho $(OBJS) $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< %.sho++ : %.cpp - $(CCPP) -c -o $@ -fPIC -DSHARED $(CCPPFLAGS) $< + $(CCPP) -c -o $@ $(SO_COMPILE_FLAGS) -DSHARED $(CCPPFLAGS) $< %$(SO) : %.sho++ $(OBJS) $(CPPOBJS) $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< @@ -302,3 +341,5 @@ BIN_OBJS = $(BINS:$(EXE)=.o) TEST_BIN_OBJS = $(TEST_BINS:$(EXE)=.o) CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) TEST_CPP_BIN_OBJS = $(TEST_CPP_BINS:$(EXE)=.o) +SH_OBJS = $(OBJS:.o=.sho) +SHPP_OBJS = $(CPP_OBJS:.o=.sho++) diff --git a/makefiles/gmake/guess_env b/makefiles/gmake/guess_env index 667de97..2e4f3de 100755 --- a/makefiles/gmake/guess_env +++ b/makefiles/gmake/guess_env @@ -11,6 +11,23 @@ case "$UNAME_SYSTEM.$UNAME_RELEASE" in Linux*) PLATFORM=LINUX OS_MAJOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 1` OS_MINOR_VERSION=`echo $UNAME_RELEASE | cut -d . -f 2` + + if test -f /etc/arch-release; then + LINUX_DIST='arch' + LINUX_REV='current' + elif test -f /etc/debian_version; then + LINUX_DIST='debian' + LINUX_REV=`cat /etc/debian_version | cut -d . -f 1` + elif test -f /etc/slackware-version; then + LINUX_DIST='slackware' + LINUX_REV=`cat /etc/slackware-version | cut -d ' ' -f 2 | cut -d . -f 1` + elif test -f /etc/redhat-release; then + LINUX_DIST='redhat' + LINUX_REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*// | cut -f 1 -d .` + else + LINUX_DIST='unknown' + LINUX_REV='unknown' + fi ;; FreeBSD*) PLATFORM=FREEBSD @@ -61,11 +78,18 @@ case "$UNAME_MACHINE" in esac +# get last line, old 'tail' syntax and POSIX syntax, both exist out there +if test "x${PLATFORM}" = "xSUNOS"; then + TAIL1='tail -1' +else + TAIL1='tail -n 1' +fi + # the compiler and version # what compiler do we have (we can't relly on it's name as it may be a cc link to the binary!) CC=$2 -(( $CC -v 2>&1 ) | grep -i GCC ) 2>/dev/null 1>/dev/null +(( $CC -v 2>&1 | $TAIL1 ) | grep -i GCC ) 2>/dev/null 1>/dev/null if test $? = 0; then COMPILER='gcc' else @@ -194,5 +218,7 @@ ICC_MINOR_VERSION=$ICC_MINOR_VERSION SPRO_MAJOR_VERSION=$SPRO_MAJOR_VERSION PCC_MAJOR_VERSION=$PCC_MAJOR_VERSION PCC_MINOR_VERSION=$PCC_MINOR_VERSION +LINUX_DIST=$LINUX_DIST +LINUX_REV=$LINUX_REV EOF fi diff --git a/makefiles/gmake/help.mk b/makefiles/gmake/help.mk index 324ff04..fc7e321 100644 --- a/makefiles/gmake/help.mk +++ b/makefiles/gmake/help.mk @@ -7,6 +7,7 @@ make doc build the documentation make clean clean up build artifacts make distclean clean up all generated artifacts make install install (set 'DESTDIR' and 'prefix' at will) +make uninstall uninstall (set 'DESTDIR' and 'prefix' at will) make dist[-Z|-gz|-bz2] create tarball containing all sources make help show this very help page make init-po create initial version of the gettext files diff --git a/makefiles/gmake/i18n.mk b/makefiles/gmake/i18n.mk index a153f6c..08a29e4 100644 --- a/makefiles/gmake/i18n.mk +++ b/makefiles/gmake/i18n.mk @@ -13,8 +13,10 @@ # - target: init-po # - target: merge-po # - taget: check-po +# - target: install_po +# - target: uninstall_po -.PHONY: init-po update-po all_po clean_po install_po +.PHONY: init-po update-po all_po clean_po install_po uninstall_po ifeq "$(ENABLE_NLS)" "1" @@ -72,11 +74,19 @@ all_po: $(MO_FILES) install_po: @test -z "$(GETTEXT_LANGUAGES)" || \ for lang in $(GETTEXT_LANGUAGES)""; do ( \ - echo "install po/$$lang.mo to $(localedir)/$$lang/LC_MESSAGES.." && \ + echo "installing po/$$lang.mo to $(localedir)/$$lang/LC_MESSAGES.." && \ $(INSTALL) -d -m 755 $(localedir)/$$lang/LC_MESSAGES && \ $(INSTALL) -m 644 po/$$lang.mo $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo || exit 1 \ ) done +uninstall_po: + @test -z "$(GETTEXT_LANGUAGES)" || \ + for lang in $(GETTEXT_LANGUAGES)""; do ( \ + echo "uninstalling $(localedir)/$$lang/LC_MESSAGES.." && \ + rm $(localedir)/$$lang/LC_MESSAGES/$(CATALOG_NAME).mo && \ + rmdir $(localedir)/$$lang/LC_MESSAGES || exit 1 \ + ) done + else # No NLS supported wanted, provide dummy targets @@ -88,5 +98,6 @@ check-po: all_po: clean_po: install_po: +uninstall_po: endif diff --git a/makefiles/gmake/install.mk b/makefiles/gmake/install.mk index 225c999..ac6d49d 100644 --- a/makefiles/gmake/install.mk +++ b/makefiles/gmake/install.mk @@ -6,6 +6,7 @@ # # provides: # - target: install +# - target: uninstall # default values DESTDIR= @@ -28,3 +29,36 @@ install_recursive: (set -e; $(MAKE) -C $$d install || exit 1); done) install: install_recursive local_install install_po + @test -d "$(libdir)" || mkdir -p "$(libdir)" + @test -z "$(STATIC_LIB)" || ( \ + $(INSTALL) -m 644 $(STATIC_LIB) $(libdir)/$(STATIC_LIB) ) + @test -z "$(DYNAMIC_LIB)" || ( \ + $(INSTALL) -m 755 $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) \ + $(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) ) + @test -z "$(DYNAMIC_LIB)" || ( \ + rm -f "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" && \ + ln -s "$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" \ + "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" ) + @test -z "$(DYNAMIC_LIB)" || ( \ + rm -f "$(libdir)/$(DYNAMIC_LIB)" && \ + ln -s "$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" \ + "$(libdir)/$(DYNAMIC_LIB)" ) + +.PHONY: uninstall_recursive uninstall local_uninstall + +uninstall_recursive: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d uninstall || exit 1); done) + +uninstall: uninstall_recursive local_uninstall uninstall_po + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -f "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" || \ + rm "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH)" ) + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -h "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" || \ + rm "$(libdir)/$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR)" ) + test -z "$(DYNAMIC_LIB)" || ( \ + test ! -h "$(libdir)/$(DYNAMIC_LIB)" || \ + rm "$(libdir)/$(DYNAMIC_LIB)" ) + test -z "$(STATIC_LIB)" || ( \ + test ! -f "$(libdir)/$(STATIC_LIB)" || rm "$(libdir)/$(STATIC_LIB)" ) diff --git a/makefiles/gmake/libs.mk b/makefiles/gmake/libs.mk new file mode 100644 index 0000000..08899c3 --- /dev/null +++ b/makefiles/gmake/libs.mk @@ -0,0 +1,53 @@ +# provides explicit library rules +# +# requires: +# - STATIC_LIB: name of the static library +# - DYNAMIC_LIB: soname and versions of the shared library +# - all others like OBJS, CPP_OBJS, LIBS, SH_OBJS, SHPP_OBJS, LDFLAGS +# +# provides: +# - targets to build the static and dynamic version of the project's library +# + +ifeq "$(PLATFORM)" "LINUX" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "SUNOS" +ifeq "$(COMPILER)" "gcc" +SO_FLAGS = -shared -Wl,-h,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif +ifeq "$(COMPILER)" "spro" +SO_FLAGS = -G -h $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif +endif + +ifeq "$(PLATFORM)" "FREEBSD" +SO_FLAGS = -shared -Wl,-x,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "OPENBSD" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "NETBSD" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifeq "$(PLATFORM)" "CYGWIN" +SO_FLAGS = -shared -Wl,-soname,$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR) +endif + +ifneq "$(STATIC_LIB)" "" +$(STATIC_LIB) : $(OBJS) $(CPP_OBJS) + $(AR) cr $@ $(OBJS) $(CPP_OBJS) +else +$(STATIC_LIB) : +endif + +ifneq "$(DYNAMIC_LIB)" "" +$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) : $(SH_OBJS) $(SHPP_OBJS) + $(CCPP_LINK) $(SO_FLAGS) -o $@ $(LDFLAGS) $(SH_OBJS) $(SHPP_OBJS) $(LIBS) +else +$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) : +endif diff --git a/makefiles/gmake/platform.mk b/makefiles/gmake/platform.mk index 3b04ecc..aaa8846 100644 --- a/makefiles/gmake/platform.mk +++ b/makefiles/gmake/platform.mk @@ -22,6 +22,10 @@ PLATFORM ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --platform $(C OS_MAJOR_VERSION ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --os-major-version $(CC) "$(CURDIR)" $(TOPDIR)) OS_MINOR_VERSION ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version $(CC) "$(CURDIR)" $(TOPDIR)) COMPILER ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --compiler $(CC) "$(CURDIR)" $(TOPDIR)) +ifeq "$(PLATFORM)" "LINUX" +LINUX_DIST ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --linux-dist $(CC) "$(CURDIR)" $(TOPDIR)) +LINUX_REV ?= $(shell $(SHELL) $(TOPDIR)/makefiles/gmake/guess_env --linux-rev $(CC) "$(CURDIR)" $(TOPDIR)) +endif # platform specific flags ######################### @@ -31,6 +35,11 @@ PLATFORM_COMPILE_FLAGS = \ -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \ -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) +ifeq "$(PLATFORM)" "LINUX" +PLATFORM_COMPILE_FLAGS += \ + -DLINUX_DIST=$(LINUX_DIST) -DLINUX_REV=$(LINUX_REV) +endif + # extensions for binaries ifeq "$(PLATFORM)" "CYGWIN" EXE = .exe diff --git a/makefiles/gmake/sub.mk b/makefiles/gmake/sub.mk index 71a08c7..962c63f 100644 --- a/makefiles/gmake/sub.mk +++ b/makefiles/gmake/sub.mk @@ -12,12 +12,12 @@ -include $(TOPDIR)/makefiles/gmake/compiler.mk .PHONY: all $(SUBDIRS) local_all -all: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) local_all all_po +all: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) $(STATIC_LIB) $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) local_all all_po @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d all || exit 1); done) .PHONY: test local_test -test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) local_test +test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) $(STATIC_LIB) local_test @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d test || exit 1); done) @@ -25,3 +25,4 @@ test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN -include $(TOPDIR)/makefiles/gmake/clean.mk -include $(TOPDIR)/makefiles/gmake/install.mk -include $(TOPDIR)/makefiles/gmake/i18n.mk +-include $(TOPDIR)/makefiles/gmake/libs.mk diff --git a/makefiles/gmake/top.mk b/makefiles/gmake/top.mk index c276758..810bedc 100644 --- a/makefiles/gmake/top.mk +++ b/makefiles/gmake/top.mk @@ -12,6 +12,8 @@ # - target 'doc' # - target 'dist' # - target 'help' +# - target 'install' +# - target 'uninstall' -include makefiles/gmake/platform.mk @@ -37,6 +39,11 @@ install: @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ (set -e; $(MAKE) -C $$d install || exit 1); done) +.PHONY: uninstall +uninstall: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d uninstall || exit 1); done) + .PHONY: test test: all @$(MAKE) -C tests test diff --git a/makefiles/nmake/clean.mk b/makefiles/nmake/clean.mk index f7cdb2b..91d941b 100644 --- a/makefiles/nmake/clean.mk +++ b/makefiles/nmake/clean.mk @@ -16,8 +16,6 @@ clean_recursive: @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 clean & cd .. #clean: clean_recursive local_clean -# -@rm -f *.bak 2>/dev/null -# -@rm -f *~ 2>/dev/null # -@rm -f *.d port/*.d 2>/dev/null # -@rm -f $(BINS) $(CPP_BINS) $(TEST_BINS) $(TEST_CPP_BINS) 2>/dev/null # -@rm -f $(OBJS) $(CPP_OBJS) $(BIN_OBJS) $(TEST_BIN_OBJS) $(CPP_BIN_OBJS) $(TEST_CPP_BIN_OBJS) 2>/dev/null @@ -37,6 +35,12 @@ clean: clean_recursive local_clean -@erase *.rc 2>NUL -@erase *.res 2>NUL -@erase MSG*.bin 2>NUL + -@erase *.dllobj 2>NUL + -@erase $(DLL_OBJS) 2>NUL + -@erase *.exp 2>NUL + -@erase *.ilk 2>NUL + -@erase *.idb 2>NUL + -@erase *.manifest 2>NUL distclean_recursive: @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 distclean & cd .. diff --git a/makefiles/nmake/compiler.mk b/makefiles/nmake/compiler.mk index 51c8596..d6988d0 100644 --- a/makefiles/nmake/compiler.mk +++ b/makefiles/nmake/compiler.mk @@ -15,9 +15,16 @@ # /nologo: disable MS disclaimer # /MT: create a multi-thread binary # /EHsc: enable C++ exception handling +# /Ox: optimize what you can +# /Zi: enable debug information +# /MTD: create multi-threaded debug binary +# /we: show warnings (level 1 to 4) +# /Wall: enable all warnings -# compilation flags and compilers +# compilation flags and compilers (release) COMMON_COMPILE_FLAGS = /MT /nologo /c $(INCLUDE_DIRS) +# compilation flags and compilers (debug) +#COMMON_COMPILE_FLAGS = /MDd /ZI /nologo /c $(INCLUDE_DIRS) /RTC1 COMPILE_FLAGS = $(COMMON_COMPILE_FLAGS) @@ -30,7 +37,12 @@ CCPP = cl.exe MC = "$(PLATFORM_SDK_DIR)\Bin\mc.exe" RC = "$(PLATFORM_SDK_DIR)\Bin\rc.exe" +# linking flags (release) LDFLAGS = /nologo $(INCLUDE_LDFLAGS) + +# linking flags (debug) +#LDFLAGS = /nologo /debug $(INCLUDE_LDFLAGS) + LIBS = $(INCLUDE_LIBS) LINK = link.exe CCPP_LINK = link.exe @@ -41,7 +53,13 @@ CCPP_LINK = link.exe $(CC) $(CFLAGS) /Fo$@ $< .cpp.obj: - $(CCPP) $(CCPPFLAGS) $< + $(CCPP) $(CCPPFLAGS) /Fo$@ $< + +.c.dllobj: + $(CC) $(CFLAGS) /D "BUILD_SHARED" /Fo$@ $< + +.cpp.dllobj: + $(CCPP) $(CCPPFLAGS) /D "BUILD_SHARED" /Fo$@ $< .obj.exe: $(CCPP_LINK) $(LDFLAGS) $(LIBS) /out:$@ $< $(OBJS) diff --git a/makefiles/nmake/config.mk b/makefiles/nmake/config.mk new file mode 100644 index 0000000..3dcdef4 --- /dev/null +++ b/makefiles/nmake/config.mk @@ -0,0 +1,44 @@ +# Configuration supposed to be configured here by the user +# +# provides: +# - PLATFORM_SDK_DIR +# - BOOST_DIR +# - OPENSSL_DIR + +# please customize + +# Windows Platform SDK +###################### + +# The location of the Windows Platform SDK +# newer versions of Visual Studio integrate the header files of the SDK +# some versions of Visual Studio miss the mc.exe binary + +PLATFORM_SDK_DIR = C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2 +#PLATFORM_SDK_DIR = C:\Programme\Microsoft Platform SDK for Windows Server 2003 R2 + +# Boost (http://www.boostpro.com/download) +########################################### + +# version of the boost library + +BOOST_VERSION=1_42 + +# base dir where boost is installed + +BOOST_DIR=C:\Program Files\boost\boost_$(BOOST_VERSION) +#BOOST_DIR=C:\Programme\boost\boost_$(BOOST_VERSION) + +# visual studio version used for compiling + +BOOST_VC_VER=vc90 +#BOOST_VC_VER=vc80 + +# TODO: probe those +BOOST_MT=-mt + +# OpenSSL (http://www.slproweb.com/products/Win32OpenSSL.html) +############################################################## + +OPENSSL_DIR=C:\Program Files\OpenSSL +#OPENSSL_DIR=C:\Programme\OpenSSL diff --git a/makefiles/nmake/platform.mk b/makefiles/nmake/platform.mk index aca9926..6c0f90d 100644 --- a/makefiles/nmake/platform.mk +++ b/makefiles/nmake/platform.mk @@ -1,17 +1,12 @@ # Sets Windows specific variables # -# requires: -# - -# # provides: # - PLATFORM_SDK_DIR: the location of the Windows Platform SDK, used # for compiling anything from the Win32 API into a binary/library # # author: Andreas Baumann, abaumann at yahoo dot com -# The location of the Windows Platform SDK -PLATFORM_SDK_DIR = C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2 -#PLATFORM_SDK_DIR = C:\Programme\Microsoft Platform SDK for Windows Server 2003 R2 +!include $(TOPDIR)\makefiles\nmake\config.mk # TODO: maybe we have to probe certain things like the version # of the visual studio or the availability of certain addons -- cgit v1.2.3-54-g00ecf