From 68354c7d41085d1f976a5b1d7ee542479a85f621 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 13 Feb 2010 09:56:58 +0100 Subject: imported trunk from sourceforge SVN --- makefiles/nmake/clean.mk | 48 +++++++++++++++++++++++ makefiles/nmake/compiler.mk | 92 +++++++++++++++++++++++++++++++++++++++++++++ makefiles/nmake/depend.mk | 67 +++++++++++++++++++++++++++++++++ makefiles/nmake/help.mk | 9 +++++ makefiles/nmake/platform.mk | 27 +++++++++++++ makefiles/nmake/sub.mk | 27 +++++++++++++ makefiles/nmake/top.mk | 39 +++++++++++++++++++ 7 files changed, 309 insertions(+) create mode 100644 makefiles/nmake/clean.mk create mode 100644 makefiles/nmake/compiler.mk create mode 100644 makefiles/nmake/depend.mk create mode 100644 makefiles/nmake/help.mk create mode 100644 makefiles/nmake/platform.mk create mode 100644 makefiles/nmake/sub.mk create mode 100644 makefiles/nmake/top.mk (limited to 'makefiles/nmake') diff --git a/makefiles/nmake/clean.mk b/makefiles/nmake/clean.mk new file mode 100644 index 0000000..91d941b --- /dev/null +++ b/makefiles/nmake/clean.mk @@ -0,0 +1,48 @@ +# cleans up directories +# +# requires: +# - SUBDIRS: for recursive cleaning +# - local_clean, local_distclean targets in local GNUmakefile +# - all artifacts to clean: +# - BINS, TEST_BINS, TEST_CPP_BINS, CPP_BINS +# - OBJS, CPPOBJS, BIN_OBJS, TEST_BIN_OBJS, CPP_BIN_OBJS, TEST_CPP_BIN_OBJS +# - CMODULES, CPPMODULES +# +# provides: +# - target: clean +# - target: distclean + +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 *.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 +# -@rm -f exec/* +# -@rm -f *.core +# -@rm -f $(CMODULES) $(CPPMODULES) +# -@rm -f $(CMODULES .o=.d) $(CPPMODULES .o=.d) +clean: clean_recursive local_clean + -@erase *.bak 2>NUL + -@erase *~ 2>NUL + -@erase *.d 2>NUL + -@erase *.exe 2>NUL + -@erase *.exe.manifest 2>NUL + -@erase *.obj 2>NUL + -@erase $(OBJS) 2>NUL + -@erase *.pdb 2>NUL + -@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 .. + +distclean: distclean_recursive local_distclean clean diff --git a/makefiles/nmake/compiler.mk b/makefiles/nmake/compiler.mk new file mode 100644 index 0000000..2cfcb17 --- /dev/null +++ b/makefiles/nmake/compiler.mk @@ -0,0 +1,92 @@ +# sets compiler settings +# +# requires: +# - INCLUDE_DIRS +# +# provides: +# - BIN_OBJS: the object files we need for the binaries which we build always +# - CPP_BIN_OBJS: same for binaries which have C++ code in them +# - TEST_BIN_OBJS: same as BIN_OBJS but for test binaries compiled only when +# testing +# - TEST_CPP_BIN_OBJS: same for C++ tests +# + +# TODO: which flags to enable? +# /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 (release) +COMMON_COMPILE_FLAGS = /MD /nologo /O2 /c $(INCLUDE_DIRS) + +# compilation flags and compilers (debug) +#COMMON_COMPILE_FLAGS = /MDd /ZI /nologo /c $(INCLUDE_DIRS) /RTC1 + +COMPILE_FLAGS = $(COMMON_COMPILE_FLAGS) + +CCPP_COMPILE_FLAGS = $(COMMON_COMPILE_FLAGS) /EHsc + +CFLAGS = $(COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) +CCPPFLAGS = $(CCPP_COMPILE_FLAGS) $(PLATFORM_COMPILE_FLAGS) $(DEBUGLEVELFLAGS) +CC = cl.exe +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 + +.SUFFIXES: .c .cpp .obj .exe .mc .rc .res + +.c.obj: + $(CC) $(CFLAGS) /Fo$@ $< + +.cpp.obj: + $(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) + +.mc.rc: + $(MC) -h $(@D) -r $(@D) $< + +.rc.res: + $(RC) $< + +#%$(EXE): %.o $(OBJS) $(TEST_OBJS) +# $(LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS) + +#%.sho : %.c +# $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $< + +#%$(SO) : %.sho $(OBJS) +# $(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $< + +#%.sho++ : %.cpp +# $(CCPP) -c -o $@ -fPIC -DSHARED $(CCPPFLAGS) $< + +#%$(SO) : %.sho++ $(OBJS) $(CPPOBJS) +# $(CCPP_LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $(CPPOBJS) $< + +#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) diff --git a/makefiles/nmake/depend.mk b/makefiles/nmake/depend.mk new file mode 100644 index 0000000..bcdb5b2 --- /dev/null +++ b/makefiles/nmake/depend.mk @@ -0,0 +1,67 @@ +# provides generic rules for C/C++ dependeny generation using +# 'makedepend', 'gcc -MM' or similar mechanisms +# +# requires: +# - compilers CC and CCPP +# - INCLUDEDIRS +# - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS +# - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS +# +# provides: +# - included dependency files +# +# author: Andreas Baumann, abaumann at yahoo dot com + +ifeq "$(COMPILER)" "gcc" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +endif + +ifeq "$(COMPILER)" "tcc" + +%.d : %.c + @echo Generating dependencies for $< + @makedepend -DMAKE_DEPENDENCIES $(INCLUDE_DIRS) -I/usr/lib/tcc/include -f - $< > $@ + +endif + +ifeq "$(COMPILER)" "icc" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $@ $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +endif + +ifeq "$(COMPILER)" "spro" + +%.d : %.c + @echo Generating dependencies for $< + @$(CC) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(INCLUDE_DIRS) $< > $@ +endif + +-include $(OBJS:.o=.d) +-include $(CPP_OBJS:.o=.d) +-include $(BIN_OBJS:.o=.d) +-include $(CPP_BIN_OBJS:.o=.d) +-include $(TEST_BIN_OBJS:.o=.d) +-include $(TEST_CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/nmake/help.mk b/makefiles/nmake/help.mk new file mode 100644 index 0000000..3e42448 --- /dev/null +++ b/makefiles/nmake/help.mk @@ -0,0 +1,9 @@ + +Available targets: + +make [all] create all artifacts +make test create test binaries and execute tests +make doc build the documentation +make clean clean up build artifacts +make distclean clean up all generated artifacts +make help show this very help page diff --git a/makefiles/nmake/platform.mk b/makefiles/nmake/platform.mk new file mode 100644 index 0000000..11f9aad --- /dev/null +++ b/makefiles/nmake/platform.mk @@ -0,0 +1,27 @@ +# 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:\Programme\Microsoft Platform SDK for Windows Server 2003 R2 + +# TODO: maybe we have to probe certain things like the version +# of the visual studio or the availability of certain addons +# like Windows Unix Services, MOSS stuff or SDKs + +#PLATFORM = $(shell $(TOPDIR)/makefiles/gmake/guess_env --platform $(CC)) +#OS_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-major-version $(CC)) +#OS_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version $(CC)) +#COMPILER = $(shell $(TOPDIR)/makefiles/gmake/guess_env --compiler $(CC)) + +#PLATFORM_COMPILE_FLAGS = \ +# -D$(PLATFORM) \ +# -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \ +# -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) diff --git a/makefiles/nmake/sub.mk b/makefiles/nmake/sub.mk new file mode 100644 index 0000000..f300e9b --- /dev/null +++ b/makefiles/nmake/sub.mk @@ -0,0 +1,27 @@ +# makefile for a sub package +# +# requires: +# - TOPDIR +# - SUBDIRS +# - INCLUDE_DIRS +# +# provides: +# - target: all targets + +!include $(TOPDIR)\makefiles\nmake\platform.mk +!include $(TOPDIR)\makefiles\nmake\compiler.mk + +all: local_all + @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 all & cd .. + +#.PHONY: all $(SUBDIRS) local_all +#all: $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) local_all +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d all || exit 1); done) + +test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) local_test + @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 test & cd .. + +#-include $(TOPDIR)/makefiles/gmake/depend.mk +!include $(TOPDIR)\makefiles\nmake\clean.mk +#-include $(TOPDIR)/makefiles/gmake/install.mk diff --git a/makefiles/nmake/top.mk b/makefiles/nmake/top.mk new file mode 100644 index 0000000..188375a --- /dev/null +++ b/makefiles/nmake/top.mk @@ -0,0 +1,39 @@ +# top-level makefile for a package +# +# requires: +# - TOPDIR +# - SUBDIRS +# +# provides: +# - target 'all' +# - target 'clean' +# - target 'distclean' +# - target 'test' +# - target 'doc' +# - target 'dist' +# - target 'help' + +all: + @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 all & cd .. + +clean: + @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 clean & cd .. + +distclean: + @if not "$(SUBDIRS)" == "" @for %%d IN ( $(SUBDIRS) ) do @cd %%d & $(MAKE) /nologo /f Makefile.w32 distclean & cd .. + +#.PHONY: install +#install: +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d install || exit 1); done) + +test: all + @cd tests & $(MAKE) /nologo /f Makefile.W32 test + +doc: + @cd docs & $(MAKE) /nologo /f Makefile.W32 doc + +help: + @type makefiles\nmake\help.mk + +#-include $(TOPDIR)/makefiles/gmake/dist.mk -- cgit v1.2.3-54-g00ecf