summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordufourj2006-04-23 16:53:20 +0000
committerdufourj2006-04-23 16:53:20 +0000
commit2c9b471e080e1fb7c5a7727512b918b0b827e026 (patch)
tree73117af8e201426a9302eca90d94ac8110f2c7a7
parent19db408880b2b607db88053f24e08779d632f3ca (diff)
Makefile :
- ajout de la gestion des utest.
-rw-r--r--i/marvin/src/Makefile.defs25
1 files changed, 24 insertions, 1 deletions
diff --git a/i/marvin/src/Makefile.defs b/i/marvin/src/Makefile.defs
index 20922f7..a811e44 100644
--- a/i/marvin/src/Makefile.defs
+++ b/i/marvin/src/Makefile.defs
@@ -30,7 +30,6 @@ SUBDIRS = utils utils/meta \
# Répertoire où placer les objets.
OBJ_DIR := obj
-DUMMY := $(shell mkdir -p $(OBJ_DIR))
# Utilise le compilateur C++ pour l'édition des liens.
LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
@@ -56,6 +55,8 @@ OBJECTS := $(OBJECTS:%.o=$(OBJ_DIR)/%.o)
build-all: $(PROGRAMS)
+utest: $(UTESTS:%=%.utest)
+
# Fabrique les règles pour créer les exécutables.
define PROGRAMS_template
$(1): $$($(1)_OBJECTS:%.o=$$(OBJ_DIR)/%.o)
@@ -64,6 +65,27 @@ endef
$(foreach prog,$(PROGRAMS),$(eval $(call PROGRAMS_template,$(prog))))
+# Creation of utest rules
+define UTESTS_template
+ifndef $(1)_UTEST
+$(1)_UTEST = PATH=$$(PATH):. $$^
+endif
+$(1).utest:
+ @echo "$$($(1)_UTEST)"; \
+ $$($(1)_UTEST); \
+ RETVAL=$$$$?; \
+ echo -n "$(1).utest: "; \
+ if [ "$$$$RETVAL" -eq "0" ]; \
+ then \
+ echo "Succeed"; \
+ else \
+ echo "Failed"; \
+ fi; \
+ exit $$$$RETVAL
+endef
+
+$(foreach utest,$(UTESTS),$(eval $(call UTESTS_template,$(utest))))
+
# Régles implicites.
%.cc: %.ll
$(LEX) $<
@@ -72,6 +94,7 @@ $(foreach prog,$(PROGRAMS),$(eval $(call PROGRAMS_template,$(prog))))
$(YACC) -o $@ $<
$(OBJ_DIR)/%.o: %.cc
+ @mkdir -p $(OBJ_DIR)
$(COMPILE.cc) $(OUTPUT_OPTION) $<
# Dépendances.