summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-06-13 20:21:31 +0200
committerAndreas Baumann <abaumann@yahoo.com>2010-06-13 20:21:31 +0200
commitd1ed63e35e95bdc73b20cebd9123d8a2d7a43ec1 (patch)
treeef0a2c210f3bd081785235575bac2e3addb7d525
parent7704c015826d571fdd9af6f1d691410f6b6355ac (diff)
downloadwolfbones-d1ed63e35e95bdc73b20cebd9123d8a2d7a43ec1.tar.gz
wolfbones-d1ed63e35e95bdc73b20cebd9123d8a2d7a43ec1.tar.bz2
removed most of the C++ stuff
added a TEST_DYNAMIC_* variables in order to be able to build test libraries (as for testing the library loader)
-rw-r--r--TODOS2
-rw-r--r--docs/libraries/README10
-rw-r--r--makefiles/gmake/clean.mk11
-rw-r--r--makefiles/gmake/compiler.mk35
-rw-r--r--makefiles/gmake/depend.mk24
-rw-r--r--makefiles/gmake/libs.mk13
-rw-r--r--makefiles/gmake/platform.mk2
-rw-r--r--makefiles/gmake/sub.mk4
-rw-r--r--tests/library/GNUmakefile8
9 files changed, 36 insertions, 73 deletions
diff --git a/TODOS b/TODOS
index 7c7607a..fbf3a5c 100644
--- a/TODOS
+++ b/TODOS
@@ -1,5 +1,5 @@
- library loader
- - make install installs the testlib, split in two
+ - make a module loader
- string library and portability layer
- snprintf:
- Solaris 8, linking trouble with _eprintf and ilbstdc++
diff --git a/docs/libraries/README b/docs/libraries/README
index 2bc1f62..04a8193 100644
--- a/docs/libraries/README
+++ b/docs/libraries/README
@@ -37,3 +37,13 @@ Goal:
we enforce on the module loader), _init and friends are used by compilers
and are dangerous, because we don't really know when they are called!
+Unsorted ideas from older times:
+- unregister all loaded libraries, so we can properly shutdown without
+ knowing what has been loaded. Not really crutial.
+- the library known a specific symbol 'registry', containing an object
+ with:
+ - global unique identifier, so we don't load something different by accident
+ - a library identifier unique per library
+ - a signature per function to allow proper casts
+
+
diff --git a/makefiles/gmake/clean.mk b/makefiles/gmake/clean.mk
index 92061d4..d80236d 100644
--- a/makefiles/gmake/clean.mk
+++ b/makefiles/gmake/clean.mk
@@ -4,9 +4,8 @@
# - 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
+# - BINS, TEST_BINS
+# - OBJS, BIN_OBJS, TEST_BIN_OBJS
#
# provides:
# - target: clean
@@ -22,12 +21,10 @@ clean: clean_recursive clean_po 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
+ -@rm -f $(BINS) $(TEST_BINS) 2>/dev/null
+ -@rm -f $(OBJS) $(BIN_OBJS) $(TEST_BIN_OBJS) 2>/dev/null
-@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 -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
diff --git a/makefiles/gmake/compiler.mk b/makefiles/gmake/compiler.mk
index 8e9c978..a2a0baa 100644
--- a/makefiles/gmake/compiler.mk
+++ b/makefiles/gmake/compiler.mk
@@ -5,10 +5,8 @@
#
# 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
#
# start of gcc section
@@ -120,10 +118,6 @@ endif
endif
-CCPP_COMPILE_FLAGS = \
- $(COMMON_COMPILE_FLAGS) \
- -std=c++98
-
# gcc 4.x
ifeq "$(GCC_MAJOR_VERSION)" "4"
CCPP_COMPILE_FLAGS += \
@@ -132,22 +126,9 @@ endif
ifeq "$(GCC_MAJOR_VERSION)" "3"
-# gcc 3.4, not tested yet
-ifeq "$(GCC_MINOR_VERSION)" "4"
-CCPP_COMPILE_FLAGS += \
- -Wno-invalid-offsetof
-endif
-
-# gcc 3.3, testend on OpenBSD 4.2
-ifeq "$(GCC_MINOR_VERSION)" "3"
-#CCPP_COMPILE_FLAGS += \
-# -Wdeclaration-after-statement
-endif
-
endif
#CC = gcc
-CCPP = g++
endif
@@ -162,7 +143,6 @@ endif
ifeq "$(COMPILER)" "tcc"
COMPILE_FLAGS = \
-Wall -Werror -Wunsupported -Wwrite-strings -g
-CCPP = tcc
endif
# end of tcc section
@@ -209,7 +189,6 @@ endif
ifeq "$(COMPILER)" "pcc"
COMPILE_FLAGS = \
--fatal-warnings -g
-CCPP = pcc
endif
# end of pcc section
@@ -313,19 +292,14 @@ 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)
LINK = $(CC)
-CCPP_LINK = $(CCPP)
%.o : %.c
$(CC) -c -o $@ $(CFLAGS) $<
-%.o : %.cpp
- $(CCPP) -c -o $@ $(CCPPFLAGS) $<
-
%$(EXE): %.o $(OBJS) $(TEST_OBJS)
$(LINK) -o $@ $(LDFLAGS) $(OBJS) $(TEST_OBJS) $< $(LIBS)
@@ -335,15 +309,6 @@ CCPP_LINK = $(CCPP)
%$(SO) : %.sho $(OBJS)
$(LINK) -shared -o $@ $(LDFLAGS) $(LIBS) $(OBJS) $<
-%.sho++ : %.cpp
- $(CCPP) -c -o $@ $(SO_COMPILE_FLAGS) -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)
SH_OBJS = $(OBJS:.o=.sho)
-SHPP_OBJS = $(CPP_OBJS:.o=.sho++)
diff --git a/makefiles/gmake/depend.mk b/makefiles/gmake/depend.mk
index cb6556c..cfe5bb5 100644
--- a/makefiles/gmake/depend.mk
+++ b/makefiles/gmake/depend.mk
@@ -1,11 +1,11 @@
-# provides generic rules for C/C++ dependeny generation using
+# provides generic rules for C dependeny generation using
# 'makedepend', 'gcc -MM' or similar mechanisms
#
# requires:
-# - compilers CC and CCPP
+# - compilers CC
# - INCLUDEDIRS
-# - OBJS, CPP_OBJS and BIN_OBJS, CPP_BIN_OBJS
-# - TEST_BINS, TEST_BIN_OBJS, TEST_CPP_BINS, TEST_CPP_BIN_OBJS
+# - OBJS and BIN_OBJS
+# - TEST_BINS, TEST_BIN_OBJS
#
# provides:
# - included dependency files
@@ -19,11 +19,6 @@ ifeq "$(COMPILER)" "gcc"
@$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \
sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
-%.d : %.cpp
- @echo Generating dependencies for $<
- @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \
- sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
-
endif
ifeq "$(COMPILER)" "tcc"
@@ -41,11 +36,6 @@ ifeq "$(COMPILER)" "icc"
@$(CC) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CFLAGS) $< | \
sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
-%.d : %.cpp
- @echo Generating dependencies for $<
- @$(CCPP) -DMAKE_DEPENDENCIES -MM -MT $(@:.d=.o) $(CCPPFLAGS) $< | \
- sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)\&\&\&\1 : \2,g" | tr -s '&' "\n" > $@
-
endif
ifeq "$(COMPILER)" "spro"
@@ -54,9 +44,6 @@ ifeq "$(COMPILER)" "spro"
@echo Generating dependencies for $<
@$(CC) -DMAKE_DEPENDENCIES -xM1 $(CFLAGS) $< > $@
-%.d : %.cpp
- @echo Generating dependencies for $<
- @$(CCPP) -DMAKE_DEPENDENCIES -xM1 $(CCPPFLAGS) $< > $@
endif
ifeq "$(COMPILER)" "pcc"
@@ -69,8 +56,5 @@ ifeq "$(COMPILER)" "pcc"
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/gmake/libs.mk b/makefiles/gmake/libs.mk
index cf0ad08..c074b76 100644
--- a/makefiles/gmake/libs.mk
+++ b/makefiles/gmake/libs.mk
@@ -3,7 +3,7 @@
# 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
+# - all others like OBJS, LIBS, SH_OBJS, LDFLAGS
#
# provides:
# - targets to build the static and dynamic version of the project's library
@@ -54,8 +54,15 @@ $(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)
+$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) : $(SH_OBJS)
+ $(LINK) $(SO_FLAGS) -o $@ $(LDFLAGS) $(SH_OBJS) $(LIBS)
else
$(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) :
endif
+
+ifneq "$(TEST_DYNAMIC_LIB)" ""
+$(TEST_DYNAMIC_LIB).$(TEST_DYNAMIC_LIB_MAJOR).$(TEST_DYNAMIC_LIB_MINOR).$(TEST_DYNAMIC_LIB_PATCH) : $(SH_OBJS)
+ $(LINK) $(SO_FLAGS) -o $@ $(LDFLAGS) $(SH_OBJS) $(LIBS)
+else
+$(TEST_DYNAMIC_LIB).$(TEST_DYNAMIC_LIB_MAJOR).$(TEST_DYNAMIC_LIB_MINOR).$(TEST_DYNAMIC_LIB_PATCH) :
+endif
diff --git a/makefiles/gmake/platform.mk b/makefiles/gmake/platform.mk
index b081a59..095d9bd 100644
--- a/makefiles/gmake/platform.mk
+++ b/makefiles/gmake/platform.mk
@@ -1,6 +1,6 @@
# 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
+# Also sets PLATFORM_COMPILE_FLAGS to be included when compiling C code
#
# requires:
# - TOPDIR
diff --git a/makefiles/gmake/sub.mk b/makefiles/gmake/sub.mk
index 962c63f..47941d9 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) $(STATIC_LIB) $(DYNAMIC_LIB).$(DYNAMIC_LIB_MAJOR).$(DYNAMIC_LIB_MINOR).$(DYNAMIC_LIB_PATCH) local_all all_po
+all: $(OBJS) $(BIN_OBJS) $(BINS) $(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) $(STATIC_LIB) local_test
+test: $(OBJS) $(TEST_OBJS) $(BIN_OBJS) $(BINS) $(CPP_BINS) $(TEST_BIN_OBJS) $(TEST_BINS) $(STATIC_LIB) $(TEST_DYNAMIC_LIB).$(TEST_DYNAMIC_LIB_MAJOR).$(TEST_DYNAMIC_LIB_MINOR).$(TEST_DYNAMIC_LIB_PATCH) local_test
@test -z "$(SUBDIRS)" || ( set -e; for d in $(SUBDIRS)""; do \
(set -e; $(MAKE) -C $$d test || exit 1); done)
diff --git a/tests/library/GNUmakefile b/tests/library/GNUmakefile
index 8b5ecc7..7b63f04 100644
--- a/tests/library/GNUmakefile
+++ b/tests/library/GNUmakefile
@@ -9,10 +9,10 @@ INCLUDE_LIBS = \
TEST_BINS = \
test_loader$(EXE)
-DYNAMIC_LIB = testlib.so
-DYNAMIC_LIB_MAJOR = 0
-DYNAMIC_LIB_MINOR = 0
-DYNAMIC_LIB_PATCH = 0
+TEST_DYNAMIC_LIB = testlib.so
+TEST_DYNAMIC_LIB_MAJOR = 0
+TEST_DYNAMIC_LIB_MINOR = 0
+TEST_DYNAMIC_LIB_PATCH = 0
OBJS = \
testlib.o