File: Makefile

package info (click to toggle)
libfiu 1.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 768 kB
  • sloc: ansic: 2,633; python: 973; makefile: 599; sh: 309
file content (67 lines) | stat: -rw-r--r-- 1,240 bytes parent folder | download | duplicates (6)
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
62
63
64
65
66
67

CFLAGS += -std=c99 -pedantic -Wall
ALL_CFLAGS = -I../../libfiu/ -L../../libfiu/ -L./ \
	-D_XOPEN_SOURCE=600 -D_GNU_SOURCE -fPIC -DFIU_ENABLE=1 $(CFLAGS)

ifdef DEBUG
ALL_CFLAGS += -g
endif

ifdef PROFILE
ALL_CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
endif

ifneq ($(V), 1)
	NICE_CC = @echo "  CC  $@"; $(CC)
	NICE_RUN = @echo "  RUN $<"; \
		   LD_LIBRARY_PATH="./:../../libfiu/"
	NICE_LN = @echo "  LN $@"; ln -f
else
	NICE_CC = $(CC)
	NICE_RUN = LD_LIBRARY_PATH="./:../../libfiu/"
	NICE_LN = ln -f
endif

default: tests

all: tests


BF = $(ALL_CFLAGS) ~ $(PREFIX)
build-flags: .force-build-flags
	@if [ x"$(BF)" != x"`cat build-flags 2>/dev/null`" ]; then \
		if [ -f build-flags ]; then \
			echo "build flags changed, rebuilding"; \
		fi; \
		echo "$(BF)" > build-flags; \
	fi

#
# Test library and binaries.
#

libcoltest.so: libcoltest.c libcoltest.h
	$(NICE_CC) $(ALL_CFLAGS) -shared -fPIC $< -o $@

binary: binary.c libcoltest.so
	$(NICE_CC) $(ALL_CFLAGS) -L. $< -lfiu -lcoltest -o $@


tests: binary
	$(NICE_RUN) ./binary

#
# Cleanup
#

clean:
	rm -f *.bb *.bbg *.da *.gcov *.gcda *.gcno gmon.out build-flags
	rm -f libcoltest.so binary

FORCE:

.PHONY: default all clean \
	tests c-tests py-tests \
	.force-build-flags