diff --git a/Makefile b/Makefile index eb6cab5..cb039a3 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,23 @@ -ROJECTNAME=OMTRTA -BIN=build/$(ROJECTNAME) +PROJECTNAME=OMTRTA +BIN=build/$(PROJECTNAME) CC=g++ EXT=cpp INCDIRS=include lib # make mode=release -ifneq ($(mode), release) - OPT=-Og -g -else +ifeq ($(mode), release) OPT=-O3 +else + OPT=-Og -g endif -EXTRAFLAGS= DEPFLAGS=-MP -MD -FLAGS=-Wall -Wextra $(foreach F,$(INCDIRS),-I$(F)) $(OPT) $(DEPFLAGS) $(EXTRAFLAGS) +FLAGS=-Wall -Wextra $(foreach F,$(INCDIRS),-I$(F)) $(OPT) $(DEPFLAGS) SRC=$(shell find . -name "*.$(EXT)" -path "./src/*") OBJ=$(subst ./src/,./build/,$(SRC:.$(EXT)=.o)) DEP=$(OBJ:.o=.d) +TEST=$(shell find . -name "*.$(EXT)" -path "./test/*") $(shell mkdir -p build) @@ -28,7 +28,7 @@ $(BIN) : $(OBJ) -include $(DEP) -build/%.o: src/%.$(EXT) +build/%.o : src/%.$(EXT) @mkdir -p $(@D) $(CC) $(FLAGS) -o $@ -c $< @@ -39,10 +39,13 @@ clean : rm -rf build/* # make test file=testGenID.cpp -test : $(OBJ) test/$(file) +test : $(OBJ) $(CC) $(FLAGS) -o build/$(file:.$(EXT)=) test/$(file) ./build/$(file:.$(EXT)=) +alltest : + @for f in $(subst ./test/,,$(TEST)); do make -s test file=$$f; done + # unzip : tar -xvf exemple.tgz dist : clean tar zcvf build/$(PROJECTNAME).tgz * @@ -55,4 +58,4 @@ info : $(info put what ever) @echo you want -.PHONY : all run clean test dist check info +.PHONY : all run clean test alltest dist check info