-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (42 loc) · 912 Bytes
/
Makefile
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
TESTS_SUFFIX=_test
CC=gcc
CFLAGS=-Wall -Werror
DEP_LIST=event.o util.o char_stream.o sat_variable.o sat_table.o sat_parser.o \
sat_args.o
CONFFILE=sat.mk
-include $(CONFFILE)
ifneq ($(TESTS)$(DEBUG),)
CFLAGS+=-g
endif
ifeq ($(TESTS),y)
PROG_SUFFIX=$(TESTS_SUFFIX)
ifeq ($(COLOURS),y)
CFLAGS+=-DCOLOURS
endif
ifeq ($(ALL_TESTS),y)
CFLAGS+=-DALL_TESTS
endif
DEP_LIST+=unit_test.o sat_test.o
else
DEP_LIST+=main.o sat.o sat_ca.o sat_print.o
endif
%.o: %.c
$(CC) -o $@ $(CFLAGS) -c $<
.PHONY: all config clean cleanall
PROG=sat$(PROG_SUFFIX)
all: $(PROG)
$(PROG): $(DEP_LIST)
$(CC) -o $@ $^
config:
@echo "doing make config"
set -e; \
rm -f $(CONFFILE); \
echo "$(strip $(MAKEFLAGS))" | sed -e 's/ /\r\n/g' > $(CONFFILE);
clean:
rm -f *.o
cleanconf:
rm -f $(CONFFILE)
cleantags:
rm -f tags
cleanall: clean cleanconf cleantags
file `ls` | grep executable | awk -F: '{ print $$1 }' | xargs rm -f