diff options
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | examples/GNUmakefile | 19 | ||||
| -rw-r--r-- | examples/Makefile | 194 | ||||
| -rw-r--r-- | tests/GNUmakefile | 31 | ||||
| -rw-r--r-- | tests/Makefile | 199 | ||||
| -rw-r--r-- | tests/array/main.cpp (renamed from tests/array.cpp) | 0 | ||||
| -rw-r--r-- | tests/circular_buffer/main.cpp (renamed from tests/circular_buffer.cpp) | 0 | ||||
| -rw-r--r-- | tests/functional/main.cpp (renamed from tests/functional.cpp) | 0 | ||||
| -rw-r--r-- | tests/matrix/main.cpp (renamed from tests/matrix.cpp) | 0 | ||||
| -rw-r--r-- | tests/meta/main.cpp (renamed from tests/meta.cpp) | 0 | ||||
| m--------- | tools/mgm | 0 |
12 files changed, 57 insertions, 393 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e5ed9e2 --- a/dev/null +++ b/.gitmodules | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | [submodule "tools/mgm"] | ||
| 2 | path = tools/mgm | ||
| 3 | url = git://julien.isonoe.net/perso/mgm | ||
| @@ -15,7 +15,11 @@ all: | |||
| 15 | @echo 'Type “make install” to install at the default location (“$(prefix)”).' | 15 | @echo 'Type “make install” to install at the default location (“$(prefix)”).' |
| 16 | @echo 'Type “make prefix=/some/directory install” to install somewhere else.' | 16 | @echo 'Type “make prefix=/some/directory install” to install somewhere else.' |
| 17 | @echo | 17 | @echo |
| 18 | @echo 'There are some examples available in the “examples/” directory.' | ||
| 18 | @echo 'Type “make test” to compile and execute the available tests.' | 19 | @echo 'Type “make test” to compile and execute the available tests.' |
| 20 | @echo | ||
| 21 | @echo 'Before running the examples or the tests, be sure to run' | ||
| 22 | @echo '“git submodule update --init”.' | ||
| 19 | 23 | ||
| 20 | install: | 24 | install: |
| 21 | $(MKDIR) -- '$(includedir)' | 25 | $(MKDIR) -- '$(includedir)' |
diff --git a/examples/GNUmakefile b/examples/GNUmakefile new file mode 100644 index 0000000..5501684 --- a/dev/null +++ b/examples/GNUmakefile | |||
| @@ -0,0 +1,19 @@ | |||
| 1 | PROJECTS := \ | ||
| 2 | array\ | ||
| 3 | array_view\ | ||
| 4 | expression\ | ||
| 5 | functional\ | ||
| 6 | interpolation\ | ||
| 7 | math\ | ||
| 8 | matrix\ | ||
| 9 | meta\ | ||
| 10 | numerical_derivate\ | ||
| 11 | quaternion\ | ||
| 12 | rational\ | ||
| 13 | ref | ||
| 14 | |||
| 15 | # Default compilation flags. | ||
| 16 | CXXFLAGS := -std=c++98 -I ../include/ -I ~/usr/include/ | ||
| 17 | |||
| 18 | # Includes MyGreatMakefile | ||
| 19 | include ../tools/mgm/mgm.mk | ||
diff --git a/examples/Makefile b/examples/Makefile deleted file mode 100644 index db4750e..0000000 --- a/examples/Makefile +++ b/dev/null | |||
| @@ -1,194 +0,0 @@ | |||
| 1 | ## | ||
| 2 | # My Great Makefile v0.4.2 | ||
| 3 | # | ||
| 4 | # Julien Fontanet <julien.fontanet@isonoe.net> | ||
| 5 | # | ||
| 6 | # Copyleft 2010 | ||
| 7 | ## | ||
| 8 | |||
| 9 | ## | ||
| 10 | # This Makefile works only with gcc/g++ (g++ is used for linking). | ||
| 11 | # The C prefix is ".c". | ||
| 12 | # The C++ prefix is ".cpp". | ||
| 13 | ## | ||
| 14 | |||
| 15 | ######################## | ||
| 16 | # Global configuration # | ||
| 17 | ######################## | ||
| 18 | |||
| 19 | # Enables colored messages during compilation. | ||
| 20 | COLORS := 1 | ||
| 21 | |||
| 22 | # Compiles in debug mode. (Necessary for the tests.) | ||
| 23 | DEBUG := 1 | ||
| 24 | |||
| 25 | # Compiles with OpenMP. | ||
| 26 | OPENMP := 1 | ||
| 27 | |||
| 28 | # Enables profiling. | ||
| 29 | PROFILING := 0 | ||
| 30 | |||
| 31 | # Strips the binary from all its debug information (reduce the binary size). | ||
| 32 | STRIP_BIN := 0 | ||
| 33 | |||
| 34 | # Displays which commands are executed during compilation. | ||
| 35 | VERBOSE := 0 | ||
| 36 | |||
| 37 | # Projects list. | ||
| 38 | PROJECTS := \ | ||
| 39 | array\ | ||
| 40 | array_view\ | ||
| 41 | expression\ | ||
| 42 | functional\ | ||
| 43 | interpolation\ | ||
| 44 | math\ | ||
| 45 | matrix\ | ||
| 46 | meta\ | ||
| 47 | numerical_derivate\ | ||
| 48 | quaternion\ | ||
| 49 | rational\ | ||
| 50 | ref | ||
| 51 | |||
| 52 | PREFIX := /usr/local | ||
| 53 | |||
| 54 | CXXFLAGS += -std=c++98 -pedantic -Wall -ggdb3 | ||
| 55 | CXXFLAGS += -Wextra -Winline -Wconversion -ggdb3 | ||
| 56 | CXXFLAGS += -I ../include/ | ||
| 57 | |||
| 58 | LDFLAGS += | ||
| 59 | |||
| 60 | |||
| 61 | ############################# | ||
| 62 | # Per project configuration # | ||
| 63 | ############################# | ||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | ########################################### | ||
| 68 | # DO NOT MODIFY ANYTHING AFTER THIS LINE. # | ||
| 69 | ########################################### | ||
| 70 | |||
| 71 | .DEFAULT_GOAL := all | ||
| 72 | CC := gcc | ||
| 73 | CFLAGS += -MMD | ||
| 74 | CXX := g++ | ||
| 75 | CXXFLAGS += -MMD | ||
| 76 | COMMON_OBJECTS := $(addsuffix .o,$(COMMON_SRCS)) | ||
| 77 | COMMON_DEPS := $(addsuffix .d,$(COMMON_SRCS)) | ||
| 78 | |||
| 79 | ifneq ($(DEBUG),1) | ||
| 80 | CFLAGS += -DNDEBUG -fno-strict-aliasing -funroll-loops -O3 -g0 | ||
| 81 | CXXFLAGS += -DNDEBUG -fno-strict-aliasing -funroll-loops -O3 -g0 | ||
| 82 | endif | ||
| 83 | |||
| 84 | ifeq ($(OPENMP),1) | ||
| 85 | CFLAGS += -fopenmp | ||
| 86 | CXXFLAGS += -fopenmp | ||
| 87 | LDFLAGS += -fopenmp | ||
| 88 | endif | ||
| 89 | |||
| 90 | ifeq ($(PROFILING),1) | ||
| 91 | CFLAGS += -pg | ||
| 92 | CXXFLAGS += -pg | ||
| 93 | LDFLAGS += -pg | ||
| 94 | endif | ||
| 95 | |||
| 96 | ifneq ($(VERBOSE),1) | ||
| 97 | .SILENT: | ||
| 98 | endif | ||
| 99 | |||
| 100 | ifeq ($(COLORS),1) | ||
| 101 | COLOR_RED := \033[0;22;31m | ||
| 102 | COLOR_GREEN := \033[0;22;32m | ||
| 103 | COLOR_YELLOW := \033[33m | ||
| 104 | COLOR_BLUE := \033[0;22;34m | ||
| 105 | COLOR_PURPLE := \033[0;22;35m | ||
| 106 | COLOR_CYAN := \033[0;22;36m | ||
| 107 | |||
| 108 | COLOR_RED_BOLD := \033[0;1;31m | ||
| 109 | COLOR_GREEN_BOLD := \033[0;1;32m | ||
| 110 | COLOR_YELLOW_BOLD := \033[0;1;33m | ||
| 111 | COLOR_BLUE_BOLD := \033[0;1;34m | ||
| 112 | COLOR_PURPLE_BOLD := \033[0;1;35m | ||
| 113 | COLOR_CYAN_BOLD := \033[0;1;36m | ||
| 114 | |||
| 115 | COLOR_NONE := \033[0m | ||
| 116 | COLOR_NONE_BOLD := \033[1m | ||
| 117 | endif | ||
| 118 | |||
| 119 | # Rules to always execute. | ||
| 120 | .PHONY: all clean distclean install uninstall | ||
| 121 | |||
| 122 | # Generic rule definition. | ||
| 123 | define PROJECT_TPL | ||
| 124 | # The default target is "bin/PROJECT_NAME". | ||
| 125 | $(1)_TARGET ?= bin/$(1) | ||
| 126 | |||
| 127 | # The default source is "PROJECT_NAME/main.cpp". | ||
| 128 | $(1)_SRCS ?= $(1)/main.cpp | ||
| 129 | |||
| 130 | # The default install directory is "PREFIX/bin". | ||
| 131 | $(1)_INSTALL_DIR ?= $(PREFIX)/bin | ||
| 132 | $(1)_INSTALL ?= $$($(1)_INSTALL_DIR)/$$(notdir $$($(1)_TARGET)) | ||
| 133 | |||
| 134 | $(1)_OBJECTS := $$(addsuffix .o,$$($(1)_SRCS)) | ||
| 135 | $(1)_DEPS := $$(addsuffix .d,$$($(1)_SRCS)) | ||
| 136 | |||
| 137 | $$($(1)_OBJECTS): CFLAGS := $(CFLAGS) $$($(1)_CFLAGS) | ||
| 138 | $$($(1)_OBJECTS): CXXFLAGS := $(CXXFLAGS) $$($(1)_CXXFLAGS) | ||
| 139 | $$($(1)_OBJECTS): Makefile | ||
| 140 | |||
| 141 | -include $$($(1)_DEPS) | ||
| 142 | |||
| 143 | all: $$($(1)_TARGET) | ||
| 144 | $$($(1)_TARGET): $$($(1)_OBJECTS) $(COMMON_OBJECTS) | ||
| 145 | mkdir -p -- '$$(@D)' | ||
| 146 | @printf ' $(COLOR_PURPLE_BOLD)L %s$(COLOR_NONE)\n' '$$@' | ||
| 147 | $(CXX) $(LDFLAGS) $$($(1)_LDFLAGS) -o '$$@' $$^ | ||
| 148 | ifeq ($(STRIP_BIN),1) | ||
| 149 | strip '$$@' | ||
| 150 | endif | ||
| 151 | |||
| 152 | $$($(1)_INSTALL): $$($(1)_TARGET) | ||
| 153 | @printf ' $(COLOR_YELLOW_BOLD)I %s$(COLOR_NONE)\n' '$$($(1)_INSTALL)' | ||
| 154 | mkdir -p -- '$$($(1)_INSTALL_DIR)' | ||
| 155 | cp -f $$^ '$$($(1)_INSTALL)' | ||
| 156 | |||
| 157 | .PHONY: install-$(1) uninstall-$(1) clean-$(1) distclean-$(1) | ||
| 158 | |||
| 159 | install: install-$(1) | ||
| 160 | install-$(1): $$($(1)_INSTALL) | ||
| 161 | |||
| 162 | uninstall: uninstall-$(1) | ||
| 163 | uninstall-$(1): | ||
| 164 | @printf ' $(COLOR_YELLOW_BOLD)U %s$(COLOR_NONE)\n' '$$($(1)_INSTALL)' | ||
| 165 | $(RM) -v '$$($(1)_INSTALL)' | ||
| 166 | |||
| 167 | clean: clean-$(1) | ||
| 168 | clean-$(1): | ||
| 169 | $(RM) -v $$($(1)_DEPS) $$($(1)_OBJECTS) | ||
| 170 | |||
| 171 | distclean: distclean-$(1) | ||
| 172 | distclean-$(1): clean-$(1) | ||
| 173 | $(RM) -v $$($(1)_TARGET) | ||
| 174 | rmdir --parents --ignore-fail-on-non-empty -- '$$(dir $$($(1)_TARGET))' | ||
| 175 | endef | ||
| 176 | |||
| 177 | # Creates rules for each project. | ||
| 178 | $(foreach project,$(PROJECTS),$(eval $(call PROJECT_TPL,$(project)))) | ||
| 179 | |||
| 180 | distclean: clean-COMMON | ||
| 181 | clean: clean-COMMON | ||
| 182 | clean-COMMON: | ||
| 183 | $(RM) -v $(COMMON_DEPS) $(COMMON_OBJECTS) | ||
| 184 | |||
| 185 | # Generic rules | ||
| 186 | .SUFFIXES: # Disable auto rules | ||
| 187 | |||
| 188 | %.c.o: %.c | ||
| 189 | @printf ' $(COLOR_BLUE_BOLD)CC %s$(COLOR_NONE)\n' '$@' | ||
| 190 | $(CC) $(CFLAGS) -c -o '$@' '$<' | ||
| 191 | |||
| 192 | %.cpp.o: %.cpp | ||
| 193 | @printf ' $(COLOR_BLUE_BOLD)CC %s$(COLOR_NONE)\n' '$@' | ||
| 194 | $(CXX) $(CXXFLAGS) -c -o '$@' '$<' | ||
diff --git a/tests/GNUmakefile b/tests/GNUmakefile new file mode 100644 index 0000000..df85065 --- a/dev/null +++ b/tests/GNUmakefile | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | PROJECTS := \ | ||
| 2 | array \ | ||
| 3 | circular_buffer \ | ||
| 4 | functional \ | ||
| 5 | matrix \ | ||
| 6 | meta | ||
| 7 | |||
| 8 | # Default compilation flags. | ||
| 9 | CXXFLAGS := -std=c++98 -I ../include/ | ||
| 10 | |||
| 11 | # Because these are unit tests (see contracts.h). | ||
| 12 | DEBUG := 1 | ||
| 13 | CXXFLAGS += -DEXDEBUG | ||
| 14 | |||
| 15 | # Includes MyGreatMakefile | ||
| 16 | include ../tools/mgm/mgm.mk | ||
| 17 | |||
| 18 | all: | ||
| 19 | @for f in bin/*; do \ | ||
| 20 | [ -x "$$f" ] || continue; \ | ||
| 21 | basename="$${f#*/}"; \ | ||
| 22 | printf '%s\033[72G' "$$basename"; \ | ||
| 23 | "$$f" 2> "$$basename".log >&2 && { \ | ||
| 24 | rm -f "$$basename.log"; \ | ||
| 25 | printf '$(COLOR_GREEN_BOLD)[passed]$(COLOR_NONE)\n'; \ | ||
| 26 | } || { \ | ||
| 27 | printf '$(COLOR_RED_BOLD)[failed]$(COLOR_NONE)\n\n$(COLOR_YELLOW_BOLD)%s$(COLOR_NONE)\n' "$$basename".log; \ | ||
| 28 | cat "$$basename".log; \ | ||
| 29 | printf '\n'; \ | ||
| 30 | } \ | ||
| 31 | done | ||
diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 0f354ba..0000000 --- a/tests/Makefile +++ b/dev/null | |||
| @@ -1,199 +0,0 @@ | |||
| 1 | ## | ||
| 2 | # My Great Makefile v0.4.2 | ||
| 3 | # | ||
| 4 | # Julien Fontanet <julien.fontanet@isonoe.net> | ||
| 5 | # | ||
| 6 | # Copyleft 2010 | ||
| 7 | ## | ||
| 8 | |||
| 9 | ## | ||
| 10 | # This Makefile works only with gcc/g++ (g++ is used for linking). | ||
| 11 | # The C prefix is ".c". | ||
| 12 | # The C++ prefix is ".cpp". | ||
| 13 | ## | ||
| 14 | |||
| 15 | ######################## | ||
| 16 | # Global configuration # | ||
| 17 | ######################## | ||
| 18 | |||
| 19 | # Enables colored messages during compilation. | ||
| 20 | COLORS := 1 | ||
| 21 | |||
| 22 | # Compiles in debug mode. (Necessary for the tests.) | ||
| 23 | DEBUG := 1 | ||
| 24 | |||
| 25 | # Compiles with OpenMP. | ||
| 26 | OPENMP := 1 | ||
| 27 | |||
| 28 | # Enables profiling. | ||
| 29 | PROFILING := 0 | ||
| 30 | |||
| 31 | # Strips the binary from all its debug information (reduce the binary size). | ||
| 32 | STRIP_BIN := 0 | ||
| 33 | |||
| 34 | # Displays which commands are executed during compilation. | ||
| 35 | VERBOSE := 0 | ||
| 36 | |||
| 37 | # Projects list. | ||
| 38 | PROJECTS := $(basename $(wildcard *.cpp)) | ||
| 39 | |||
| 40 | PREFIX := /usr/local | ||
| 41 | |||
| 42 | CXXFLAGS += -DEXDEBUG | ||
| 43 | CXXFLAGS += -std=c++98 -pedantic -Wall -ggdb3 | ||
| 44 | CXXFLAGS += -Wextra -Winline -Wconversion -ggdb3 | ||
| 45 | CXXFLAGS += -I ../include/ | ||
| 46 | |||
| 47 | LDFLAGS += | ||
| 48 | |||
| 49 | |||
| 50 | ############################# | ||
| 51 | # Per project configuration # | ||
| 52 | ############################# | ||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | ########################################### | ||
| 57 | # DO NOT MODIFY ANYTHING AFTER THIS LINE. # | ||
| 58 | ########################################### | ||
| 59 | |||
| 60 | .DEFAULT_GOAL := all | ||
| 61 | CC := gcc | ||
| 62 | CFLAGS += -MMD | ||
| 63 | CXX := g++ | ||
| 64 | CXXFLAGS += -MMD | ||
| 65 | COMMON_OBJECTS := $(addsuffix .o,$(COMMON_SRCS)) | ||
| 66 | COMMON_DEPS := $(addsuffix .d,$(COMMON_SRCS)) | ||
| 67 | |||
| 68 | ifneq ($(DEBUG),1) | ||
| 69 | CFLAGS += -DNDEBUG -fno-strict-aliasing -funroll-loops -O3 -g0 | ||
| 70 | CXXFLAGS += -DNDEBUG -fno-strict-aliasing -funroll-loops -O3 -g0 | ||
| 71 | endif | ||
| 72 | |||
| 73 | ifeq ($(OPENMP),1) | ||
| 74 | CFLAGS += -fopenmp | ||
| 75 | CXXFLAGS += -fopenmp | ||
| 76 | LDFLAGS += -fopenmp | ||
| 77 | endif | ||
| 78 | |||
| 79 | ifeq ($(PROFILING),1) | ||
| 80 | CFLAGS += -pg | ||
| 81 | CXXFLAGS += -pg | ||
| 82 | LDFLAGS += -pg | ||
| 83 | endif | ||
| 84 | |||
| 85 | ifneq ($(VERBOSE),1) | ||
| 86 | .SILENT: | ||
| 87 | endif | ||
| 88 | |||
| 89 | ifeq ($(COLORS),1) | ||
| 90 | COLOR_RED := \033[0;22;31m | ||
| 91 | COLOR_GREEN := \033[0;22;32m | ||
| 92 | COLOR_YELLOW := \033[33m | ||
| 93 | COLOR_BLUE := \033[0;22;34m | ||
| 94 | COLOR_PURPLE := \033[0;22;35m | ||
| 95 | COLOR_CYAN := \033[0;22;36m | ||
| 96 | |||
| 97 | COLOR_RED_BOLD := \033[0;1;31m | ||
| 98 | COLOR_GREEN_BOLD := \033[0;1;32m | ||
| 99 | COLOR_YELLOW_BOLD := \033[0;1;33m | ||
| 100 | COLOR_BLUE_BOLD := \033[0;1;34m | ||
| 101 | COLOR_PURPLE_BOLD := \033[0;1;35m | ||
| 102 | COLOR_CYAN_BOLD := \033[0;1;36m | ||
| 103 | |||
| 104 | COLOR_NONE := \033[0m | ||
| 105 | COLOR_NONE_BOLD := \033[1m | ||
| 106 | endif | ||
| 107 | |||
| 108 | # Rules to always execute. | ||
| 109 | .PHONY: all clean distclean install uninstall | ||
| 110 | |||
| 111 | # Generic rule definition. | ||
| 112 | define PROJECT_TPL | ||
| 113 | # The default target is "bin/PROJECT_NAME". | ||
| 114 | $(1)_TARGET ?= bin/$(1) | ||
| 115 | |||
| 116 | # The default source is "PROJECT_NAME.cpp". | ||
| 117 | $(1)_SRCS ?= $(1).cpp | ||
| 118 | |||
| 119 | # The default install directory is "PREFIX/bin". | ||
| 120 | $(1)_INSTALL_DIR ?= $(PREFIX)/bin | ||
| 121 | $(1)_INSTALL ?= $$($(1)_INSTALL_DIR)/$$(notdir $$($(1)_TARGET)) | ||
| 122 | |||
| 123 | $(1)_OBJECTS := $$(addsuffix .o,$$($(1)_SRCS)) | ||
| 124 | $(1)_DEPS := $$(addsuffix .d,$$($(1)_SRCS)) | ||
| 125 | |||
| 126 | $$($(1)_OBJECTS): CFLAGS := $(CFLAGS) $$($(1)_CFLAGS) | ||
| 127 | $$($(1)_OBJECTS): CXXFLAGS := $(CXXFLAGS) $$($(1)_CXXFLAGS) | ||
| 128 | $$($(1)_OBJECTS): Makefile | ||
| 129 | |||
| 130 | -include $$($(1)_DEPS) | ||
| 131 | |||
| 132 | all: $$($(1)_TARGET) | ||
| 133 | $$($(1)_TARGET): $$($(1)_OBJECTS) $(COMMON_OBJECTS) | ||
| 134 | mkdir -p -- '$$(@D)' | ||
| 135 | @printf ' $(COLOR_PURPLE_BOLD)L %s$(COLOR_NONE)\n' '$$@' | ||
| 136 | $(CXX) $(LDFLAGS) $$($(1)_LDFLAGS) -o '$$@' $$^ | ||
| 137 | ifeq ($(STRIP_BIN),1) | ||
| 138 | strip '$$@' | ||
| 139 | endif | ||
| 140 | |||
| 141 | $$($(1)_INSTALL): $$($(1)_TARGET) | ||
| 142 | @printf ' $(COLOR_YELLOW_BOLD)I %s$(COLOR_NONE)\n' '$$($(1)_INSTALL)' | ||
| 143 | mkdir -p -- '$$($(1)_INSTALL_DIR)' | ||
| 144 | cp -f $$^ '$$($(1)_INSTALL)' | ||
| 145 | |||
| 146 | .PHONY: install-$(1) uninstall-$(1) clean-$(1) distclean-$(1) | ||
| 147 | |||
| 148 | install: install-$(1) | ||
| 149 | install-$(1): $$($(1)_INSTALL) | ||
| 150 | |||
| 151 | uninstall: uninstall-$(1) | ||
| 152 | uninstall-$(1): | ||
| 153 | @printf ' $(COLOR_YELLOW_BOLD)U %s$(COLOR_NONE)\n' '$$($(1)_INSTALL)' | ||
| 154 | $(RM) -v '$$($(1)_INSTALL)' | ||
| 155 | |||
| 156 | clean: clean-$(1) | ||
| 157 | clean-$(1): | ||
| 158 | $(RM) -v $$($(1)_DEPS) $$($(1)_OBJECTS) | ||
| 159 | |||
| 160 | distclean: distclean-$(1) | ||
| 161 | distclean-$(1): clean-$(1) | ||
| 162 | $(RM) -v $$($(1)_TARGET) | ||
| 163 | rmdir --parents --ignore-fail-on-non-empty -- '$$(dir $$($(1)_TARGET))' | ||
| 164 | endef | ||
| 165 | |||
| 166 | # Creates rules for each project. | ||
| 167 | $(foreach project,$(PROJECTS),$(eval $(call PROJECT_TPL,$(project)))) | ||
| 168 | |||
| 169 | distclean: clean-COMMON | ||
| 170 | clean: clean-COMMON | ||
| 171 | clean-COMMON: | ||
| 172 | $(RM) -v $(COMMON_DEPS) $(COMMON_OBJECTS) | ||
| 173 | |||
| 174 | # Generic rules | ||
| 175 | .SUFFIXES: # Disable auto rules | ||
| 176 | |||
| 177 | %.c.o: %.c | ||
| 178 | @printf ' $(COLOR_BLUE_BOLD)CC %s$(COLOR_NONE)\n' '$@' | ||
| 179 | $(CC) $(CFLAGS) -c -o '$@' '$<' | ||
| 180 | |||
| 181 | %.cpp.o: %.cpp | ||
| 182 | @printf ' $(COLOR_BLUE_BOLD)CC %s$(COLOR_NONE)\n' '$@' | ||
| 183 | $(CXX) $(CXXFLAGS) -c -o '$@' '$<' | ||
| 184 | |||
| 185 | # Run each test. | ||
| 186 | all: | ||
| 187 | @for f in bin/*; do \ | ||
| 188 | [ -x "$$f" ] || continue; \ | ||
| 189 | basename="$${f#*/}"; \ | ||
| 190 | printf '%s\033[72G' "$$basename"; \ | ||
| 191 | "$$f" 2> "$$basename".log >&2 && { \ | ||
| 192 | rm -f "$$basename.log"; \ | ||
| 193 | printf '$(COLOR_GREEN_BOLD)[passed]$(COLOR_NONE)\n'; \ | ||
| 194 | } || { \ | ||
| 195 | printf '$(COLOR_RED_BOLD)[failed]$(COLOR_NONE)\n\n$(COLOR_YELLOW_BOLD)%s$(COLOR_NONE)\n' "$$basename".log; \ | ||
| 196 | cat "$$basename".log; \ | ||
| 197 | printf '\n'; \ | ||
| 198 | } \ | ||
| 199 | done | ||
diff --git a/tests/array.cpp b/tests/array/main.cpp index cb07ce1..cb07ce1 100644 --- a/tests/array.cpp +++ b/tests/array/main.cpp | |||
diff --git a/tests/circular_buffer.cpp b/tests/circular_buffer/main.cpp index 37ebdfb..37ebdfb 100644 --- a/tests/circular_buffer.cpp +++ b/tests/circular_buffer/main.cpp | |||
diff --git a/tests/functional.cpp b/tests/functional/main.cpp index fc9d801..fc9d801 100644 --- a/tests/functional.cpp +++ b/tests/functional/main.cpp | |||
diff --git a/tests/matrix.cpp b/tests/matrix/main.cpp index b89d971..b89d971 100644 --- a/tests/matrix.cpp +++ b/tests/matrix/main.cpp | |||
diff --git a/tests/meta.cpp b/tests/meta/main.cpp index a6188a0..a6188a0 100644 --- a/tests/meta.cpp +++ b/tests/meta/main.cpp | |||
diff --git a/tools/mgm b/tools/mgm new file mode 160000 | |||
| Subproject 9b6b172cdd1dd5d13a9e3d9d837cccd13732897 | |||
