# Include the variables that describe targets
include targets.mk
-all: ${LIB}
+all: ${G_LIB}
-DIRMK := dir.mk
-VARSMK := vars.mk
-FILESMK := files.mk
-RULESMK := rules.mk
+G_DIRMK := dir.mk
+G_VARSMK := vars.mk
+G_FILESMK := files.mk
+G_RULESMK := rules.mk
+G_LISTSMK := lists.mk
+G_TVARSMK := tvars.mk
-include ${VARSMK}
+
+include ${G_VARSMK}
+include ${G_LISTSMK}
# include all of the dir.mk
-include lib/${DIRMK}
-include tests/${DIRMK}
+include lib/${G_DIRMK}
+#include tests/${G_DIRMK}
+
+# Do not include deps files when doing a clean operation
+ifeq ($(filter ${L_CLEANCMDS},${MAKECMDGOALS}),)
+ -include ${L_DEPS}
+endif
P := lib
CURDIR := lib/
-include ${CURDIR}${VARSMK}
+include ${CURDIR}${G_VARSMK}
-include ${CURDIR}pre-${DIRMK}
+include ${CURDIR}${G_LISTSMK}
# steps on variables
- include ${SRCSDIR_$P}${DIRMK}
+ include ${SRCSDIR_$P}${G_DIRMK}
# Restore variables
CURDIR := lib/
-include ${CURDIR}post-${DIRMK}
+include ${CURDIR}${G_TVARSMK}
-include ${CURDIR}${RULESMK}
+include ${CURDIR}${G_RULESMK}
+
+L_DEPS += ${L_DEPS_$P}
-# Do not include deps files when doing a clean operation
-ifeq ($(filter ${CLEANCMDS},${MAKECMDGOALS}),)
- -include ${DEPS_$P}
-endif
--- /dev/null
+
+# lists populated by dir.mk files in subdirectories
+L_SRCS_$P := # := start
+L_OBJS_$P := # := start
+L_DEPS_$P := # := start
+
+L_BLDDIRS_$P := # := start
+
+L_BLDDIRS_$P += ${OBJSDIR_$P}
+L_BLDDIRS_$P += ${DEPSDIR_$P}
+L_BLDDIRS_$P += ${WORKINGDIR_$P}
+
+++ /dev/null
-
-# add flags specific to the library target and all prerequisites
-${OBJS_$P} ${DEPS_$P}: CXXFLAGS := ${CXXFLAGS_$P}
-${OBJS_$P} ${DEPS_$P}: INCFLAGS := ${INCFLAGS_$P}
- ${DEPS_$P}: OBJSDIR := ${OBJSDIR_$P}
-
-${TARGETTMP_$P}: LNKFLAGS := ${LNKFLAGS_$P}
-${TARGETTMP_$P}: LIBS := ${LIBS_$P}
-
-$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
-$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
-$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
-$P-clean: TARGET := ${TARGET_$P}
+++ /dev/null
-
-# lists populated by dir.mk files in subdirectories
-SRCS_$P := # := start
-OBJS_$P := # := start
-DEPS_$P := # := start
-
-BLDDIRS_$P := # := start
-
-BLDDIRS_$P += ${OBJSDIR_$P}
-BLDDIRS_$P += ${DEPSDIR_$P}
-BLDDIRS_$P += ${WORKINGDIR_$P}
-
rm /usr/lib/${SONAME}
-${LIB}: ${TARGET_$P}
-${LIB_OBJS}: ${OBJS_$P}
-${LIB_DEPS}: ${DEPS_$P}
+${G_LIB}: ${TARGET_$P}
+${G_LIB_OBJS}: ${L_OBJS_$P}
+${G_LIB_DEPS}: ${L_DEPS_$P}
# how to link the main target
-${TARGETTMP_$P}: ${OBJS_$P} | $${@D}
+${TARGETTMP_$P}: ${L_OBJS_$P} | $${@D}
${Q1}${PRNTFMT} "${CXX}" "$@"
${Q2}${CXX} ${CXXFLAGS} ${LNKFLAGS} -o $@ $^ ${LIBS}
${Q2}cp $< $@
# how to make a directory
-${BLDDIRS_$P}:
+${L_BLDDIRS_$P}:
${Q1}${PRNTFMT} "mkdir" "$@"
${Q2}mkdir -p $@
sed 's/\(^.*\):/$(subst /,\/,${OBJSDIR}\1 $@):/' > $@
-CLEANCMDS += $P-cleanbin
+L_CLEANCMDS += $P-cleanbin
cleanbin: $P-cleanbin
.PHONY: $P-cleanbin
$P-cleanbin:
${Q1}${PRNTFMT} "rm" "${WORKINGDIR}"
${Q2}rm -rf ${WORKINGDIR}
-CLEANCMDS += $P-cleanobjs
+L_CLEANCMDS += $P-cleanobjs
cleanobjs: $P-cleanobjs
.PHONY: $P-cleanobjs
$P-cleanobjs:
${Q1}${PRNTFMT} "rm" "${OBJSDIR}"
${Q2}rm -rf ${OBJSDIR}
-CLEANCMDS += $P-cleandeps
+L_CLEANCMDS += $P-cleandeps
cleandeps: $P-cleandeps
.PHONY: $P-cleandeps
$P-cleandeps:
${Q1}${PRNTFMT} "rm" "${DEPSDIR}"
${Q2}rm -rf ${DEPSDIR}
-CLEANCMDS += $P-clean
+L_CLEANCMDS += $P-clean
clean: $P-clean
.PHONY: $P-clean
$P-clean: $P-cleanobjs
${Q1}${PRNTFMT} "rm" "${TARGET}"
${Q2}rm -f ${TARGET}
-CLEANCMDS += $P-cleanall
+L_CLEANCMDS += $P-cleanall
cleanall: $P-cleanall
.PHONY: $P-cleanall
$P-cleanall: $P-cleanbin $P-cleanobjs $P-cleandeps
CURDIR := lib/src/
SRCPATH :=
-include ${CURDIR}${FILESMK}
-include $(addprefix ${SRCSDIR_$P},$(addsuffix ${DIRMK},${NEWDIRS}))
+include ${CURDIR}${G_FILESMK}
+include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS}))
# Append to lists
-SRCS_$P += ${NEWSRCS}
-OBJS_$P += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
-DEPS_$P += $(addprefix ${DEPSDIR_$P},${NEWDEPS})
+L_SRCS_$P += ${NEWSRCS}
+L_OBJS_$P += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
+L_DEPS_$P += $(addprefix ${DEPSDIR_$P},${NEWDEPS})
-BLDDIRS_$P += $(addprefix ${OBJSDIR_$P},${NEWDIRS})
-BLDDIRS_$P += $(addprefix ${DEPSDIR_$P},${NEWDIRS})
+L_BLDDIRS_$P += $(addprefix ${OBJSDIR_$P},${NEWDIRS})
+L_BLDDIRS_$P += $(addprefix ${DEPSDIR_$P},${NEWDIRS})
CURDIR := lib/src/locks/
SRCPATH := locks/
-include ${CURDIR}${FILESMK}
-include $(addprefix ${SRCSDIR_$P},$(addsuffix ${DIRMK},${NEWDIRS}))
+include ${CURDIR}${G_FILESMK}
+include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS}))
# Append to lists
-SRCS_$P += ${NEWSRCS}
-OBJS_$P += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
-DEPS_$P += $(addprefix ${DEPSDIR_$P},${NEWDEPS})
+L_SRCS_$P += ${NEWSRCS}
+L_OBJS_$P += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
+L_DEPS_$P += $(addprefix ${DEPSDIR_$P},${NEWDEPS})
-BLDDIRS_$P += $(addprefix ${OBJSDIR_$P},${NEWDIRS})
-BLDDIRS_$P += $(addprefix ${DEPSDIR_$P},${NEWDIRS})
+L_BLDDIRS_$P += $(addprefix ${OBJSDIR_$P},${NEWDIRS})
+L_BLDDIRS_$P += $(addprefix ${DEPSDIR_$P},${NEWDIRS})
--- /dev/null
+
+# add flags specific to the library target and all prerequisites
+${L_OBJS_$P} ${L_DEPS_$P}: CXX := ${CXX_$P}
+${L_OBJS_$P} ${L_DEPS_$P}: CXXFLAGS := ${CXXFLAGS_$P}
+${L_OBJS_$P} ${L_DEPS_$P}: INCFLAGS := ${INCFLAGS_$P}
+ ${L_DEPS_$P}: DEPSDIR := ${DEPSDIR_$P}
+ ${L_DEPS_$P}: OBJSDIR := ${OBJSDIR_$P}
+
+${TARGETTMP_$P}: CXX := ${CXX_$P}
+${TARGETTMP_$P}: CXXFLAGS := ${CXXFLAGS_$P}
+${TARGETTMP_$P}: LNKFLAGS := ${LNKFLAGS_$P}
+${TARGETTMP_$P}: LIBS := ${LIBS_$P}
+
+$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
+$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
+$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
+$P-clean: TARGET := ${TARGET_$P}
+
-CXXFLAGS_$P := ${CXXFLAGS} -fPIC
+CXX_$P := ${G_CXX}
+CXXFLAGS_$P := ${G_CXXFLAGS} -fPIC
SRCSDIR_$P := ${CURDIR}src/
DEPSDIR_$P := ${CURDIR}deps/
-INCDIRS_$P := ${SRCSDIR_$P} ${CURDIR}inc/
-INCFLAGS_$P := $(addprefix -I, ${INCDIRS_$P})
+T_INCDIRS_$P := ${SRCSDIR_$P} ${CURDIR}inc/
+INCFLAGS_$P := $(addprefix -I, ${T_INCDIRS_$P})
+T_INCDIRS_$P :=
ifeq (${BUILD},WIN32)
ifeq (${BUILD},WIN32)
- LIBGL_$P := -lopengl32 -lglu32
- LIBSDL_$P := `/usr/mingw32/bin/sdl-config --libs`
+ T_LIBGL_$P := -lopengl32 -lglu32
+ T_LIBSDL_$P := `/usr/mingw32/bin/sdl-config --libs`
else
- LIBGL_$P := -lGL -lGLU
- LIBSDL_$P := `sdl-config --libs`
+ T_LIBGL_$P := -lGL -lGLU
+ T_LIBSDL_$P := `sdl-config --libs`
endif
LIBS_$P := ${LIBSDL_$P} ${LIBGL_$P}
+T_LIBGL_$P :=
+T_LIBSDL_$P :=
+
ifeq (${BUILD},WIN32)
LINKERNAME_$P := bear.dll
--- /dev/null
+
+L_CLEANCMDS := # empty
+L_DEPS := # empty
+
# LIB: the target of the lib directory
-LIB := lib
-.PHONY: ${LIB}
+G_LIB := lib
+.PHONY: ${G_LIB}
-LIB_OBJS := lib-objs
-.PHONY: ${LIB_OBJS}
+G_LIB_OBJS := lib-objs
+.PHONY: ${G_LIB_OBJS}
-LIB_DEPS := lib-deps
-.PHONY: ${LIB_DEPS}
+G_LIB_DEPS := lib-deps
+.PHONY: ${G_LIB_DEPS}
# TESTS: build all of the tests
-TESTS := tests
-.PHONY: ${TESTS}
+G_TESTS := tests
+.PHONY: ${G_TESTS}
-CLEANCMDS += cleanbin
+L_CLEANCMDS += cleanbin
.PHONY: cleanbin
cleanbin:
-CLEANCMDS += cleanobjs
+L_CLEANCMDS += cleanobjs
.PHONY: cleanobjs
cleanobjs:
-CLEANCMDS += cleandeps
+L_CLEANCMDS += cleandeps
.PHONY: cleandeps
cleandeps:
-CLEANCMDS += clean
+L_CLEANCMDS += clean
.PHONY: clean
clean: cleanobjs
-CLEANCMDS += cleanall
+L_CLEANCMDS += cleanall
.PHONY: cleanall
cleanall: cleanbin cleanobjs cleandeps
-OPTFLAGS := -O2
-DBGFLAGS := -ggdb
-PRFFLAGS := ${DBGFLAGS} -pg
-WARFLAGS := -Wall -Wextra -pedantic -ansi
+T_OPTFLAGS := -O2
+T_DBGFLAGS := -ggdb
+T_PRFFLAGS := ${G_DBGFLAGS} -pg
+T_WARFLAGS := -Wall -Wextra -pedantic -ansi
-CXXFLAGS := ${WARFLAGS}
+G_CXXFLAGS := ${T_WARFLAGS}
ifeq (${BUILD},WIN32)
- CXXFLAGS += ${OPTFLAGS}
+ G_CXXFLAGS += ${T_OPTFLAGS}
else
ifeq (${BUILD},FINAL)
- CXXFLAGS += ${OPTFLAGS}
+ G_CXXFLAGS += ${T_OPTFLAGS}
else
- CXXFLAGS += ${DBGFLAGS}
+ G_CXXFLAGS += ${T_DBGFLAGS}
endif
endif
+T_OPTFLAGS :=
+T_DBGFLAGS :=
+T_PRFFLAGS :=
+T_WARFLAGS :=
+
+
ifeq (${BUILD},WIN32)
- CXX := mingw32-g++
+ G_CXX := mingw32-g++
else
- CXX := g++
+ G_CXX := g++
endif
ifeq (${BUILD},WIN32)