Makefile 919 Bytes
Newer Older
Mikaël Salson's avatar
Mikaël Salson committed
1
CC=g++
2
CXXFLAGS=-W -Wall -g -O0
Mikaël Salson's avatar
Mikaël Salson committed
3 4 5 6
INCLUDE=-I ..
LDFLAGS=
SRC= tests.cpp
EXEC=$(SRC:.cpp=)
Mathieu Giraud's avatar
Mathieu Giraud committed
7
OTHER_SRC=$(wildcard *.cpp)
8
LIB=../core/vidjil.a
Mikaël Salson's avatar
Mikaël Salson committed
9 10
SHOULD=$(wildcard *.should_get)
SHOULD_LOG=$(SHOULD:.should_get=.log)
Mikaël Salson's avatar
Mikaël Salson committed
11

Mikaël Salson's avatar
Mikaël Salson committed
12
.PHONY: all force clean forcedep
Mikaël Salson's avatar
Mikaël Salson committed
13 14 15 16 17 18 19 20 21 22 23

test: all
	@echo
	@echo "*** Launching unit tests..."
	./tests
	cat tests.cpp.tap
	@echo "*** All unit tests passed"

all: core $(EXEC)
	@echo "All tests compiled."

24
should: vidjil $(SHOULD_LOG)
Mikaël Salson's avatar
Mikaël Salson committed
25 26 27 28

%.log: %.should_get force
	./should-to-tap.sh $<

Mathieu Giraud's avatar
Mathieu Giraud committed
29
$(EXEC): % : %.o $(LIB) 
30
	$(CC) -o $@ $< $(LIB) $(LDFLAGS) $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
31 32 33 34


../core.a: core

35 36 37
vidjil:
	make OPTIM="-O0 -g" -C ../

Mikaël Salson's avatar
Mikaël Salson committed
38
core:
39
	make OPTIM="-O0 -g" -C ../core 
Mikaël Salson's avatar
Mikaël Salson committed
40

Mathieu Giraud's avatar
Mathieu Giraud committed
41
%.o: %.cpp $(OTHER_SRC)
42
	$(CC) -o $@ $(INCLUDE) -c $< $(CXXFLAGS)
Mikaël Salson's avatar
Mikaël Salson committed
43 44 45 46 47 48 49

clean:
	rm -f *.o $(EXEC) *.tap *.log

forcedep:
	g++ $(INCLUDE) -M $(SRC) > dep.mk

Mikaël Salson's avatar
Mikaël Salson committed
50 51
force:

Mikaël Salson's avatar
Mikaël Salson committed
52 53 54 55 56 57 58
DEP=$(wildcard dep.mk)

ifeq (${DEP},)
$(shell	g++ $(INCLUDE) -M $(SRC) > dep.mk)
endif
include dep.mk