2 export CFLAGS
:= -O2
-Wall
-Werror
3 export LDFLAGS
:= -levent
5 sources
:= $(shell ls
*.c | fgrep
-v
$(program
))
6 objects
:= $(sources
:.c
=.o
)
7 tests
:= $(sources
:%=tests
/test_
%)
11 debug
: export CFLAGS
:= -g
-pg
-Wall
-Werror
-DDEBUG
12 debug
: export LDFLAGS
:= -pg
-levent
15 check: export CFLAGS
:= -g
-pg
-Wall
-Werror
16 check: export LDFLAGS
:= -pg
-levent
17 check: tests
/cutcheck
$(objects
)
21 #ifneq ($(MAKECMDGOALS),clean)
22 -include $(sources
:%.c
=.
%.d
) .
$(program
).d
25 $(program
): $(objects
) $(program
).o
27 tests
/cutcheck.c
: $(tests
)
28 cutgen
-o tests
/cutcheck.c
$(tests
)
30 tests
/cutcheck
: tests
/cutcheck.o
$(objects
) $(tests
:.c
=.o
)
32 pkg
: check-for-version
$(program
)-$(VERSION
).
tar.gz
35 @
test "$(VERSION)" ||
{ echo Usage
: make pkg
'VERSION=<vers>'; false
; }
38 .
/pkg.sh
$(program
) $* $@
41 rm -f
$(program
) *.o .
*.d tests
/*.o tests
/cutcheck
* core gmon.out
42 rm -f
$(program
)-*.
tar.gz
45 .PHONY
: all debug
check pkg check-for-version
clean
47 # This tells make how to generate dependency files
49 @
$(SHELL
) -ec
'$(CC) -MM $(CPPFLAGS) $< \
50 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
51 [ -s $@ ] || rm -f $@'