-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.test
62 lines (45 loc) · 1.19 KB
/
Makefile.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# (c) 2015 Stephen L Arnold
# add metrics test vars
CAT = cat
MCSTRIP = ./mcstrip
CYCLO = ./cyclo
DIFF = diff -u
CYFLAGS = -DANSI -I./
# Compilation configuration
CC = gcc
CXX = g++
CPP = gcc -E
RM = rm -f
# we need flex to work around some limitations of certain lex versions
LEX = flex
DBG ?= -g
MYLDFLAGS = $(CFLAGS) $(LDFLAGS) $(DBG)
MYCFLAGS = -O2 -pipe $(CFLAGS) $(DBG)
MYCXXFLAGS = $(MYCFLAGS)
LDADD = -lstdc++ -lfl
.SUFFIXES:
.SUFFIXES: .o .c .C .l
GENSRCS = mcstrip.c scan.c
BLDSRCS = lib.C main.C strerror.c
MCSOBJS = mcstrip.o strerror.o
CYCOBJS = main.o lib.o
SCNOBJS = scan.o
TSTSRCS = test-input.c
TSTOUT = *.preproc *.stripped *.metrics
.INTERMEDIATE: $(GENSRCS)
.PHONY: all test
.DEFAULT: all
PGMS = mcstrip cyclo
all: $(PGMS)
mcstrip: $(MCSOBJS)
cyclo: $(CYCOBJS) $(SCNOBJS)
$(CXX) -o $@ $(MYCXXFLAGS) $(MYLDFLAGS) $^ $(LDADD)
test: all
@echo "Creating test data..."
$(CPP) $(CYFLAGS) test-input.c > test-input.c.preproc
$(MCSTRIP) test-input.c.preproc > test-input.c.stripped
$(CAT) test-input.c.stripped | $(CYCLO) -c > test-input.c.metrics
@echo "Comparing test results..."
$(DIFF) test-base.txt test-input.c.metrics
clean:
$(RM) cyclo mcstrip core *.o *~ $(TSTOUT)