Makefile 868 Bytes
Newer Older
Mikaël Salson's avatar
Mikaël Salson committed
1 2 3 4 5 6
CC=g++
CFLAGS=-W -Wall -g -O0
INCLUDE=-I ..
LDFLAGS=
SRC= tests.cpp
EXEC=$(SRC:.cpp=)
Mathieu Giraud's avatar
Mathieu Giraud committed
7 8
OTHER_SRC=$(wildcard *.cpp)
LIB=../core.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."

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

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

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


../core.a: core

core:
Mathieu Giraud's avatar
Mathieu Giraud committed
36
	make OPTIM="-O0 -g" -C .. core.a
Mikaël Salson's avatar
Mikaël Salson committed
37

Mathieu Giraud's avatar
Mathieu Giraud committed
38
%.o: %.cpp $(OTHER_SRC)
Mikaël Salson's avatar
Mikaël Salson committed
39 40 41 42 43 44 45 46
	$(CC) -o $@ $(INCLUDE) -c $< $(CFLAGS)

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

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

Mikaël Salson's avatar
Mikaël Salson committed
47 48
force:

Mikaël Salson's avatar
Mikaël Salson committed
49 50 51 52 53 54 55
DEP=$(wildcard dep.mk)

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