summaryrefslogtreecommitdiff
path: root/makefiles/nmake
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-02-27 13:09:06 +0100
committerAndreas Baumann <abaumann@yahoo.com>2009-02-27 13:09:06 +0100
commit5f7c401d3a5553f628d83df3832e19de22e64ca9 (patch)
tree12f5d2c6eec055f89daef1a8ceca64977812e390 /makefiles/nmake
parentb25d92d869e37e9b8467889c0f7311c70815cfd8 (diff)
downloadwolfbones-5f7c401d3a5553f628d83df3832e19de22e64ca9.tar.gz
wolfbones-5f7c401d3a5553f628d83df3832e19de22e64ca9.tar.bz2
synchronized nmake with gmake, kept W32 adaptions which are already working
Diffstat (limited to 'makefiles/nmake')
-rw-r--r--makefiles/nmake/clean.mk28
-rw-r--r--makefiles/nmake/compiler.mk12
-rw-r--r--makefiles/nmake/depend.mk47
-rw-r--r--makefiles/nmake/platform.mk42
-rw-r--r--makefiles/nmake/sub.mk5
-rw-r--r--makefiles/nmake/top.mk22
6 files changed, 122 insertions, 34 deletions
diff --git a/makefiles/nmake/clean.mk b/makefiles/nmake/clean.mk
index 5740dff..0d25b93 100644
--- a/makefiles/nmake/clean.mk
+++ b/makefiles/nmake/clean.mk
@@ -1,9 +1,12 @@
# cleans up directories
#
# requires:
-# - BINS, OBJS, CPPOBJS, BIN_OBJS
-# - CMODULES, CPPMODULES
-# - SUBDIRS
+# - 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
@@ -12,19 +15,20 @@
#.PHONY: clean_recursive clean local_clean
#clean_recursive:
+#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)
+# -@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
+# -@rm -f exec/*
+# -@rm -f *.core
+# -@rm -f $(CMODULES) $(CPPMODULES)
+# -@rm -f $(CMODULES .o=.d) $(CPPMODULES .o=.d)
clean:
-@erase *.bak 2>NUL
-@erase *~ 2>NUL
diff --git a/makefiles/nmake/compiler.mk b/makefiles/nmake/compiler.mk
index fa4fd74..789ec2a 100644
--- a/makefiles/nmake/compiler.mk
+++ b/makefiles/nmake/compiler.mk
@@ -4,7 +4,11 @@
# - INCLUDE_DIRS
#
# provides:
-# - BIN_OBJS: the object files we need for the binaries (containing the main)
+# - 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?
@@ -38,8 +42,8 @@ CCPP_LINK = link.exe
.obj.exe:
$(CCPP_LINK) $(LDFLAGS) $(LIBS) /out:$@ $< $(OBJS)
-#%$(EXE): %.o $(OBJS)
-# $(CCPP_LINK) -o $@ $(LIBS) $(OBJS) $<
+#%$(EXE): %.o $(OBJS) $(TEST_OBJS)
+# $(LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS)
#%.sho : %.c
# $(CC) -c -o $@ -fPIC -DSHARED $(CFLAGS) $<
@@ -54,4 +58,6 @@ CCPP_LINK = link.exe
# $(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
index bd49fe1..bcdb5b2 100644
--- a/makefiles/nmake/depend.mk
+++ b/makefiles/nmake/depend.mk
@@ -4,27 +4,64 @@
# requires:
# - compilers CC and CCPP
# - INCLUDEDIRS
-# - OBJS, CPP_OBJS and BIN_OBJS
+# - 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
-MAKEDEPEND = $(CC) -MM $(INCLUDE_DIRS)
-CCPP_MAKEDEPEND = $(CCPP) -MM $(INCLUDE_DIRS)
+ifeq "$(COMPILER)" "gcc"
%.d : %.c
@echo Generating dependencies for $<
- @$(MAKEDEPEND) $(CFLAGS) $< | \
+ @$(CC) -DMAKE_DEPENDENCIES -MM -MT $@ $(CFLAGS) $< | \
sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
%.d : %.cpp
@echo Generating dependencies for $<
- @$(CCPP_MAKEDEPEND) $(CCPPFLAGS) $< | \
+ @$(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/platform.mk b/makefiles/nmake/platform.mk
index 36d5ebb..95843fb 100644
--- a/makefiles/nmake/platform.mk
+++ b/makefiles/nmake/platform.mk
@@ -7,28 +7,50 @@
#
# provides:
# - PLATFORM
-# - OS_MAJOR_VERSION
-# - OS_MINOR_VERSION
+# - OS_MAJOR_VERSION and OS_MINOR_VERSION
+# - GCC_MAJOR_VERSION and GCC_MINOR_VERSION
# - PLATFORM_COMPILE_FLAGS
# - EXE
# - SO
+# - INSTALL
#
# 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 = $(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)
-LIBS_DL = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-dl)
-LIBS_SSP = $(shell $(TOPDIR)/makefiles/gmake/guess_env --libs-ssl)
-
+# extensions for binaries
+ifeq "$(PLATFORM)" "CYGWIN"
+EXE = .exe
+else
EXE =
+endif
+
+# extensions for shared libraries
+# (TOOD: HP/Unix has .shlib, Mac/X has .lib, but we can't test it currently)
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))
+# name if the installation program
+# (TODO: use the MIT or openradio install-sh script instead?)
+INSTALL = $(shell $(TOPDIR)/makefiles/gmake/guess_env --install)
+ifeq "$(PLATFORM)" "SUNOS"
+INSTALL = /usr/ucb/install
+else
+INSTALL = install
+endif
+
+# the linker library for dynamically loadable modules
+# (TODO: check for all platforms, as soon we add loadable modules here from
+# old TextWolf)
+ifeq "$(PLATFORM)" "LINUX"
+LIBS_DL = -ldl
+else
+LIBS_DL =
+endif
diff --git a/makefiles/nmake/sub.mk b/makefiles/nmake/sub.mk
index 0050ef3..a62018d 100644
--- a/makefiles/nmake/sub.mk
+++ b/makefiles/nmake/sub.mk
@@ -12,14 +12,15 @@
!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)
+#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)
#.PHONY: test local_test
-#test: local_test $(OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(CMODULES) $(CPPMODULES)
+#test: $(OBJS) $(TEST_OBJS) $(CPPOBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(TEST_CPP_BINS) $(CMODULES) $(CPPMODULES) local_test
# @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
+#-include $(TOPDIR)/makefiles/gmake/install.mk
diff --git a/makefiles/nmake/top.mk b/makefiles/nmake/top.mk
index 98993f7..8463c53 100644
--- a/makefiles/nmake/top.mk
+++ b/makefiles/nmake/top.mk
@@ -9,6 +9,9 @@
# - target 'clean'
# - target 'distclean'
# - target 'test'
+# - target 'doc'
+# - target 'dist'
+# - target 'help'
.PHONY: all
all:
@@ -21,10 +24,25 @@ clean:
(set -e; $(MAKE) -C $$d clean || exit 1); done)
.PHONY: distclean
-distclean: clean
- test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
+distclean:
+ @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
(set -e; $(MAKE) -C $$d distclean || exit 1); done)
+.PHONY: install
+install:
+ @test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
+ (set -e; $(MAKE) -C $$d install || exit 1); done)
+
.PHONY: test
test: all
@$(MAKE) -C tests test
+
+.PHONY: doc
+doc:
+ cd docs; $(MAKE) doc
+
+.PHONY: help
+help:
+ @cat makefiles/help.mk
+
+-include $(TOPDIR)/makefiles/gmake/dist.mk