Read the whole command before sending DRAINING.
[beanstalkd.git] / Makefile
blobefaae02782c3c0d933d21c51812bc20368d3f8f5
1 program := beanstalkd
2 export CFLAGS := $(CFLAGS) -Wall -Werror
3 export LDFLAGS := $(LDFLAGS) -levent
5 sources := $(shell ls *.c | fgrep -v $(program))
6 objects := $(sources:.c=.o)
7 tests := $(sources:%=tests/test_%)
9 all: export CFLAGS := $(CFLAGS) -O2
10 all: $(program)
12 debug: export CFLAGS := $(CFLAGS) -g -pg -DDEBUG
13 debug: export LDFLAGS := $(LDFLAGS) -pg
14 debug: $(program)
16 check: export CFLAGS := $(CFLAGS) -g -pg
17 check: export LDFLAGS := $(LDFLAGS) -pg -levent
18 check: tests/cutcheck $(objects)
19 ./tests/cutcheck
20 @echo
22 #ifneq ($(MAKECMDGOALS),clean)
23 -include $(sources:%.c=.%.d) .$(program).d
24 #endif
26 $(program): $(objects) $(program).o
28 tests/cutcheck.c: $(tests)
29 cutgen -o tests/cutcheck.c $(tests)
31 tests/cutcheck: tests/cutcheck.o $(objects) $(tests:.c=.o)
33 pkg: check-for-version $(program)-$(VERSION).tar.gz
35 check-for-version:
36 @test "$(VERSION)" || { echo Usage: make pkg 'VERSION=<vers>'; false; }
38 $(program)-%.tar.gz:
39 ./pkg.sh $(program) $* $@
41 clean:
42 rm -f $(program) *.o .*.d tests/*.o tests/cutcheck* core gmon.out
43 rm -f $(program)-*.tar.gz
45 # .DELETE_ON_ERROR:
46 .PHONY: all debug check pkg check-for-version clean
48 # This tells make how to generate dependency files
49 .%.d: %.c
50 @$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \
51 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
52 [ -s $@ ] || rm -f $@'