# include all of the dir.mk
include lib/${G_DIRMK}
-#include tests/${G_DIRMK}
+include tests/${G_DIRMK}
# Do not include deps files when doing a clean operation
ifeq ($(filter ${L_CLEANCMDS},${MAKECMDGOALS}),)
T_LIBGL_$P := -lGL -lGLU
T_LIBSDL_$P := `sdl-config --libs`
endif
-LIBS_$P := ${LIBSDL_$P} ${LIBGL_$P}
+LIBS_$P := ${T_LIBSDL_$P} ${T_LIBGL_$P}
T_LIBGL_$P :=
T_LIBSDL_$P :=
G_TESTS := tests
.PHONY: ${G_TESTS}
+G_TESTS_OBJS := tests-objs
+.PHONY: ${G_TESTS_OBJS}
+
+G_TESTS_DEPS := tests-deps
+.PHONY: ${G_TESTS_DEPS}
+
L_CLEANCMDS += cleanbin
.PHONY: cleanbin
cleanbin:
P := tests
CURDIR := tests/
-include ${CURDIR}${VARSMK}
+include ${CURDIR}${G_VARSMK}
+
+include ${CURDIR}${G_LISTSMK}
# steps on variables
-include ${SRCSDIR_$P}${DIRMK}
+include ${SRCSDIR_$P}${G_DIRMK}
# Restore variables
CURDIR := tests/
-INCFLAGS_$P := $(addprefix -I, ${INCDIRS_$P})
-${OBJS_$P} ${DEPS_$P}: CXXFLAGS := ${CXXFLAGS_$P}
-${OBJS_$P} ${DEPS_$P}: INCFLAGS := ${INCFLAGS_$P}
- ${DEPS_$P}: OBJSDIRS := ${OBJSDIRS_$P}
-
-$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
-$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
-$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
-$P-clean: TARGET := ${TARGET_$P}
+include ${CURDIR}${G_TVARSMK}
-include ${CURDIR}${RULESMK}
+include ${CURDIR}${G_RULESMK}
-# Do not include deps files when doing a clean operation
-ifeq ($(filter ${CLEANCMDS},${MAKECMDGOALS}),)
- -include ${DEPS_$P}
-endif
+L_DEPS += ${L_DEPS_$P}
-P :=
--- /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}
+
+${G_TESTS_OBJS}: ${L_OBJS_$P}
+${G_TESTS_DEPS}: ${L_DEPS_$P}
+
# how to make a directory
-${BLDDIRS_$P}:
+${L_BLDDIRS_$P}:
${Q1}${PRNTFMT} "mkdir" "$@"
${Q2}mkdir -p $@
${Q1}${PRNTFMT} "DEP" "$@"
${Q2}${CXX} -MM ${CXXFLAGS} $< ${INCFLAGS} | sed 's/\(^.*\):/$(subst /,\/,${@:${DEPSDIR}%.d=${OBJSDIR}%.o} $@):/' > $@
-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 := tests/src/1/
SRCPATH := 1/
-include ${CURDIR}${VARSMK}
+include ${CURDIR}${G_VARSMK}
-SRCS_$D :=
-OBJS_$D :=
-DEPS_$D :=
+include ${CURDIR}${G_LISTSMK}
-include ${CURDIR}${FILESMK}
+include ${CURDIR}${G_FILESMK}
-SRCS_$P += ${SRCS_$D}
-OBJS_$P += ${OBJS_$D}
-DEPS_$P += ${DEPS_$D}
-
-include $(addprefix ${SRCSDIR_$P},$(addsuffix ${DIRMK},${NEWDIRS}))
+include $(addprefix ${SRCSDIR_$P},$(addsuffix ${G_DIRMK},${NEWDIRS}))
# restore
CURDIR := tests/src/1/
SRCPATH := 1/
+L_SRCS_$P += ${L_SRCS_$D}
+L_OBJS_$P += ${L_OBJS_$D}
+L_DEPS_$P += ${L_DEPS_$D}
+
+include ${CURDIR}${G_TVARSMK}
-include ${CURDIR}${RULESMK}
+include ${CURDIR}${G_RULESMK}
-D :=
# Append to lists
-SRCS_$D += ${NEWSRCS}
-OBJS_$D += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
-DEPS_$D += $(addprefix ${DEPSDIR_$P},${NEWDEPS})
+L_SRCS_$D += ${NEWSRCS}
+L_OBJS_$D += $(addprefix ${OBJSDIR_$P},${NEWOBJS})
+L_DEPS_$D += $(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
+
+L_SRCS_$D :=
+L_OBJS_$D :=
+L_DEPS_$D :=
+
+${G_TESTS}: ${TARGET_$D}
+
# how to link the main target
-${TARGETTMP_$D}: ${OBJS_$D} | $${@D}
+${TARGETTMP_$D}: ${L_OBJS_$D} | $${@D}
${Q1}${PRNTFMT} "${CXX}" "$@"
${Q2}${CXX} ${CXXFLAGS} ${LNKFLAGS} -o $@ $^ ${LIBS}
-# TARGET will be built by default
-tests: ${TARGET_$D}
-
# rule to copy tmp target to working directory
${TARGET_$D}: ${TARGETTMP_$D} | $${@D}
${Q1}${PRNTFMT} "cp" "$@"
--- /dev/null
+
+${TARGETTMP_$D}: CXX := ${CXX_$D}
+${TARGETTMP_$D}: CXXFLAGS := ${CXXFLAGS_$D}
+${TARGETTMP_$D}: LNKFLAGS := ${LNKFLAGS_$D}
+${TARGETTMP_$D}: LIBS := ${LIBS_$D}
+
+$P-clean: TARGET := ${TARGET_$D}
-ifeq (${BUILD},WIN32)
- LIBGL_$D := -lopengl32 -lglu32
- LIBSDL_$D := `/usr/mingw32/bin/sdl-config --libs`
-else
- LIBGL_$D := -lGL -lGLU
- LIBSDL_$D := `sdl-config --libs`
-endif
-LIBS_$D := ${LIBSDL_$D} ${LIBGL_$D}
+CXX_$D := ${CXX_$P}
+CXXFLAGS_$D := ${CXXFLAGS_$P}
+LNKFLAGS_$D := ${LNKFLAGS_$P}
+LIBS_$D := ${LIBS_$P}
TARGETNAME_$D := test-1
TARGETTMP_$D := ${OBJSDIR_$P}${TARGETNAME_$D}
TARGET_$D := ${WORKINGDIR_$P}${TARGETNAME_$D}
-${TARGETTMP_$D}: LNKFLAGS := -Wl,-rpath,${RPATH_$P} -rdynamic
-${TARGETTMP_$D}: LIBS := ${LIBS_$P}
-
CURDIR := tests/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})
--- /dev/null
+
+${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}
+
+$P-cleanbin: WORKINGDIR := ${WORKINGDIR_$P}
+$P-cleanobjs: OBJSDIR := ${OBJSDIR_$P}
+$P-cleandeps: DEPSDIR := ${DEPSDIR_$P}
+
-CXXFLAGS_$P := ${CXXFLAGS}
+CXX_$P := ${G_CXX}
+CXXFLAGS_$P := ${G_CXXFLAGS}
+LNKFLAGS_$P := ${G_LNKFLAGS} -Wl,-rpath,./ -rdynamic
+
+ifeq (${BUILD},WIN32)
+ T_LIBGL_$P := -lopengl32 -lglu32
+ T_LIBSDL_$P := `/usr/mingw32/bin/sdl-config --libs`
+else
+ T_LIBGL_$P := -lGL -lGLU
+ T_LIBSDL_$P := `sdl-config --libs`
+endif
+LIBS_$P := ${T_LIBSDL_$P} ${T_LIBGL_$P}
+
+T_LIBGL_$P :=
+T_LIBSDL_$P :=
+
SRCSDIR_$P := ${CURDIR}src/
DEPSDIR_$P := ${CURDIR}deps/
-INCDIRS_$P := lib/inc/
+
+T_INCDIRS_$P := lib/inc/
+INCFLAGS_$P := $(addprefix -I, ${T_INCDIRS_$P})
+T_INCDIRS_$P :=
ifeq (${BUILD},WIN32)
OBJSDIR_$P := ${CURDIR}objs-mingw32/
LIBSCPY_$P += libbear.so.0
LIBSCPY_$P := $(addprefix ${DSTLIBSDIR_$P},${LIBSCPY_$P})
-
-RPATH_$P := ./
-
-
-# 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}
-
T_OPTFLAGS := -O2
T_DBGFLAGS := -ggdb
-T_PRFFLAGS := ${G_DBGFLAGS} -pg
+T_PRFFLAGS := ${T_DBGFLAGS} -pg
T_WARFLAGS := -Wall -Wextra -pedantic -ansi
G_CXXFLAGS := ${T_WARFLAGS}
T_PRFFLAGS :=
T_WARFLAGS :=
+G_LNKFLAGS :=
ifeq (${BUILD},WIN32)
G_CXX := mingw32-g++