-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
55 lines (42 loc) · 1.29 KB
/
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
54
55
# @file Makefile
#
# @brief This Makefile for Ascii85 code on posix target
#
# @par
# Copyright © 2017 Doug Currie, Londonderry, NH, USA. All rights reserved.
#
LINT = /usr/local/bin/flexe-lint/flint
TARGET = test
TEST_FLAGS = -fprofile-instr-generate -fcoverage-mapping
CFLAGS = -std=c99 -Wall -Wextra -Wmissing-prototypes $(TEST_FLAGS)
TEST_OBJS = \
lcut/lcut.o \
lcut/xorshift_e.o \
test_ascii85.o
TARGET_OBJS = \
ascii85.o
# pull in dependency info for *existing* .o files
-include $(OBJS:.o=.d)
# automatic dependency tracking from http://scottmcpeak.com/autodepend/autodepend.html
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
$(CC) -MM $(CFLAGS) $*.c > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
# version.h is changed every time the make is performed
# testapp: version_header $(TARGET)
#
# .PHONY: version_header
# version_header:
# @echo "#define SVN_VERSION \"`svnversion -n .`\"" > version.h
$(TARGET): $(TEST_OBJS) $(TARGET_OBJS) Makefile
$(CC) $(TEST_OBJS) $(TARGET_OBJS) $(LDFLAGS) $(TEST_FLAGS) -o $(TARGET)
.PHONY: lint
lint:
$(LINT) lint/em3.lnt $(TARGET_OBJS:.o=.c)
.PHONY: clean
clean:
rm -f *.o *.d cmsis/*.o cmsis/*.d lcut/*.o lcut/*.d