2 CFLAGS
+= -std
=c99
-pedantic
-Wall
-rdynamic
3 ALL_CFLAGS
= -I..
/libfiu
/ -L..
/libfiu
/ \
4 -D_XOPEN_SOURCE
=600 -D_GNU_SOURCE
-fPIC
-DFIU_ENABLE
=1 $(CFLAGS
)
11 ALL_CFLAGS
+= -g
-pg
-fprofile-arcs
-ftest-coverage
15 NICE_CC
= @echo
" CC $@"; $(CC
)
16 NICE_RUN
= @echo
" RUN $<"; LD_LIBRARY_PATH
=..
/libfiu
/
17 NICE_PY
= @echo
" PY $<"; .
/wrap-python
2
18 NICE_LN
= @echo
" LN $@"; ln
-f
21 NICE_RUN
= LD_LIBRARY_PATH
=..
/libfiu
/
22 NICE_PY
= .
/wrap-python
2
30 tests
: c-tests py-tests gen-tests utils-tests
33 # Link the libraries to a single place, some of the tests need this.
37 libs
/fiu_posix_preload.so
: ..
/preload
/posix
/fiu_posix_preload.so libs
40 libs
/fiu_run_preload.so
: ..
/preload
/run
/fiu_run_preload.so libs
43 lnlibs
: libs
/fiu_posix_preload.so libs
/fiu_run_preload.so
50 C_SRCS
:= $(wildcard test-
*.c
)
51 C_OBJS
:= $(patsubst %.c
,%.o
,$(C_SRCS
))
52 C_BINS
:= $(patsubst %.c
,%,$(C_SRCS
))
54 c-tests
: $(patsubst %.c
,c-run-
%,$(C_SRCS
))
56 test-
%: test-
%.o build-flags
57 $(NICE_CC
) $(ALL_CFLAGS
) $< -lfiu
-lpthread
-o
$@
63 BF
= $(ALL_CFLAGS
) ~
$(PREFIX
)
64 build-flags
: .force-build-flags
65 @if
[ x
"$(BF)" != x
"`cat build-flags 2>/dev/null`" ]; then \
66 if
[ -f build-flags
]; then \
67 echo
"build flags changed, rebuilding"; \
69 echo
"$(BF)" > build-flags
; \
73 $(NICE_CC
) $(ALL_CFLAGS
) -c
$< -o
$@
80 PY_TESTS
:= $(wildcard test-
*.py
)
82 py-tests
: $(patsubst %.py
,py-run-
%,$(PY_TESTS
))
84 py-run-
%: %.py lnlibs small-cat
87 small-cat
: small-cat.c
88 $(NICE_CC
) $(ALL_CFLAGS
) $< -o
$@
104 # Normally, $C_OBJS and $C_BINS are removed by make after building,
105 # since here they're considered "intermediate files"; however we
106 # also remove them when cleaning just in case.
108 rm -f
$(C_OBJS
) $(C_BINS
)
109 rm -rf libs
/ small-cat
110 rm -f
*.bb
*.bbg
*.da
*.gcov
*.gcda
*.gcno gmon.out build-flags
111 $(MAKE
) -C generated
clean
115 .PHONY
: default
all clean \
116 tests c-tests py-tests gen-tests utils-tests \