diff options
author | Andreas Baumann <abaumann@yahoo.com> | 2009-02-26 14:14:31 +0100 |
---|---|---|
committer | Andreas Baumann <abaumann@yahoo.com> | 2009-02-26 14:14:31 +0100 |
commit | bc3e79ea24a0fb7fda6f54a6f72e3a46943b1cec (patch) | |
tree | dc6c01c2d10cf12cc6ca9b0d3ed31b7759b9dcbd /makefiles | |
parent | fa74e6ffbd82c77e72497097e4e4366cd24e3b61 (diff) | |
download | wolfbones-bc3e79ea24a0fb7fda6f54a6f72e3a46943b1cec.tar.gz wolfbones-bc3e79ea24a0fb7fda6f54a6f72e3a46943b1cec.tar.bz2 |
temporary Win32 checkin
Diffstat (limited to 'makefiles')
-rw-r--r-- | makefiles/nmake/clean.mk | 43 | ||||
-rw-r--r-- | makefiles/nmake/compiler.mk | 56 | ||||
-rw-r--r-- | makefiles/nmake/depend.mk | 30 | ||||
-rw-r--r-- | makefiles/nmake/platform.mk | 34 | ||||
-rw-r--r-- | makefiles/nmake/sub.mk | 25 | ||||
-rw-r--r-- | makefiles/nmake/top.mk | 30 |
6 files changed, 218 insertions, 0 deletions
diff --git a/makefiles/nmake/clean.mk b/makefiles/nmake/clean.mk new file mode 100644 index 0000000..4c25f90 --- /dev/null +++ b/makefiles/nmake/clean.mk @@ -0,0 +1,43 @@ +# cleans up directories +# +# requires: +# - BINS, OBJS, CPPOBJS, BIN_OBJS +# - CMODULES, CPPMODULES +# - SUBDIRS +# +# provides: +# - target: clean +# - target: distclean + +#.PHONY: clean_recursive clean local_clean + +#clean_recursive: +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d clean || exit 1); done) + +#clean: clean_recursive local_clean +# -@rm *.bak 2>/dev/null +# -@rm *~ 2>/dev/null +# -@rm *.d port/*.d 2>/dev/null +# -@rm $(BINS) $(CPP_BINS) 2>/dev/null +# -@rm $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) 2>/dev/null +# -@rm exec/* +# -@rm *.core +# -@rm $(CMODULES) $(CPPMODULES) +# -@rm $(CMODULES .o=.d) $(CPPMODULES .o=.d) +clean: + -@erase *.bak + -@erase *~ + -@erase *.d + -@erase *.exe + -@erase *.exe.manifest + -@erase *.obj + -@erase *.pdb + +#.PHONY: distclean_recursive distclean local_distclean + +#distclean_recursive: +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d distclean || exit 1); done) + +#distclean: distclean_recursive local_distclean clean diff --git a/makefiles/nmake/compiler.mk b/makefiles/nmake/compiler.mk new file mode 100644 index 0000000..a351041 --- /dev/null +++ b/makefiles/nmake/compiler.mk @@ -0,0 +1,56 @@ +# sets compiler settings +# +# requires: +# - INCLUDE_DIRS +# +# provides: +# - BIN_OBJS: the object files we need for the binaries (containing the main) +# + +# /EHsc: enable C++ exception handling + +# compilation flags and compilers +COMMON_COMPILE_FLAGS = /MD /nologo /c $(INCLUDE_DIRS) + +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 + +LDFLAGS = /nologo $(LDFLAGS_DIR) +LIBS = $(LIBS_DIR) +LINK = link.exe +CCPP_LINK = link.exe + +.SUFFIXES: .c .cpp .obj .exe + +.c.obj: + $(CC) $(CFLAGS) $< + +.cpp.obj: + $(CCPP) $(CCPPFLAGS) $< + +.obj.exe: + $(CCPP_LINK) $(LDFLAGS) /out:$@ $< $(OBJS) + +#%$(EXE): %.o $(OBJS) +# $(CCPP_LINK) -o $@ $(LIBS) $(OBJS) $< + +#%.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) +#CPP_BIN_OBJS = $(CPP_BINS:$(EXE)=.o) diff --git a/makefiles/nmake/depend.mk b/makefiles/nmake/depend.mk new file mode 100644 index 0000000..bd49fe1 --- /dev/null +++ b/makefiles/nmake/depend.mk @@ -0,0 +1,30 @@ +# 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 +# +# provides: +# - included dependency files +# +# author: Andreas Baumann, abaumann at yahoo dot com + +MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS) +CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS) + +%.d : %.c + @echo Generating dependencies for $< + @$(MAKEDEPEND) $(CFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +%.d : %.cpp + @echo Generating dependencies for $< + @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@ + +-include $(OBJS:.o=.d) +-include $(CPP_OBJS:.o=.d) +-include $(BIN_OBJS:.o=.d) +-include $(CPP_BIN_OBJS:.o=.d) diff --git a/makefiles/nmake/platform.mk b/makefiles/nmake/platform.mk new file mode 100644 index 0000000..36d5ebb --- /dev/null +++ b/makefiles/nmake/platform.mk @@ -0,0 +1,34 @@ +# sets e. g. to LINUX, OS_MAJOR_VERSION to 2 and OS_MINOR_VERSION to 6 +# by calling the 'guess_env' shell script, where the actual probing happens +# Also sets PLATFORM_COMPILE_FLAGS to be included when compiling C/C++ code +# +# requires: +# - TOPDIR +# +# provides: +# - PLATFORM +# - OS_MAJOR_VERSION +# - OS_MINOR_VERSION +# - PLATFORM_COMPILE_FLAGS +# - EXE +# - SO +# +# author: Andreas Baumann, abaumann at yahoo dot com + +PLATFORM = $(shell $(TOPDIR)/makefiles/gmake/guess_env --platform) +OS_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-major-version) +OS_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version) + +PLATFORM_COMPILE_FLAGS = \ + -D$(PLATFORM) \ + -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \ + -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) + +LIBS_DL = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-dl) +LIBS_SSP = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-ssl) + +EXE = +SO = .so + +GCC_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-major-version $(CC)) +GCC_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --gcc-minor-version $(CC)) diff --git a/makefiles/nmake/sub.mk b/makefiles/nmake/sub.mk new file mode 100644 index 0000000..0050ef3 --- /dev/null +++ b/makefiles/nmake/sub.mk @@ -0,0 +1,25 @@ +# makefile for a sub package +# +# requires: +# - TOPDIR +# - SUBDIRS +# - INCLUDE_DIRS +# +# provides: +# - target: all targets + +#-include $(TOPDIR)/makefiles/gmake/platform.mk +!include $(TOPDIR)\makefiles\nmake\compiler.mk + +#.PHONY: all $(SUBDIRS) local_all +#all: local_all $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(CPP_BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d all || exit 1); done) + +#.PHONY: test local_test +#test: local_test $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES) +# @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ +# (set -e; $(MAKE) -C $$d test || exit 1); done) + +#-include $(TOPDIR)/makefiles/gmake/depend.mk +!include $(TOPDIR)\makefiles\nmake\clean.mk diff --git a/makefiles/nmake/top.mk b/makefiles/nmake/top.mk new file mode 100644 index 0000000..98993f7 --- /dev/null +++ b/makefiles/nmake/top.mk @@ -0,0 +1,30 @@ +# top-level makefile for a package +# +# requires: +# - TOPDIR +# - SUBDIRS +# +# provides: +# - target 'all' +# - target 'clean' +# - target 'distclean' +# - target 'test' + +.PHONY: all +all: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d all || exit 1); done) + +.PHONY: clean +clean: + @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d clean || exit 1); done) + +.PHONY: distclean +distclean: clean + test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \ + (set -e; $(MAKE) -C $$d distclean || exit 1); done) + +.PHONY: test +test: all + @$(MAKE) -C tests test |