Makefile: add test.o to clean
[flog.git] / Makefile
blob0ff84a4db298dddb5ee3af62164b63fe0359dee3
1 ##Config
2 CC = gcc
3 CFLAGS = -Wall -Os
4 LDFLAGS = -Wall -Os
5 ifdef DEBUG
6 CFLAGS += -g -DDEBUG
7 LDFLAGS += -g -DDEBUG
8 endif
9 ifdef PROFILE
10 CFLAGS += -pg
11 LDFLAGS += -pg
12 endif
13 LIB = libflog.a
14 DOXYGEN = doxygen
15 VALGRIND = valgrind -v --leak-check=full
17 ##Files
18 HEADER = config.h flog_msg_id.h flog.h flog_string.h flog_output_stdio.h flog_output_file.h
19 SRC = flog_msg_id.c flog.c flog_string.c flog_output_stdio.c flog_output_file.c
20 OBJ = $(SRC:.c=.o)
22 ##Rules
23 .PHONY : all lib clean distclean valgrind_test
25 all: lib
27 lib: $(LIB)
29 %.o: %.c
30 $(CC) $(CFLAGS) -c $< -o $@
32 $(LIB): $(OBJ) $(HEADER)
33 $(AR) r $(LIB) $(OBJ)
35 test: $(LIB) $(HEADER) test.o
36 $(CC) $(LDFLAGS) test.o $(LIB) -o $@
38 doxygen: Doxyfile $(SRC) $(HEADER)
39 $(DOXYGEN)
41 valgrind_test: test
42 $(VALGRIND) ./$<
44 clean:
45 $(RM) $(OBJ) $(LIB) test.o test
47 distclean: clean
48 $(RM) -r doxygen
49 $(RM) *.log