-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (32 loc) · 1.03 KB
/
Makefile
File metadata and controls
43 lines (32 loc) · 1.03 KB
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
PROGRAM_NAME= libsyslog.so
CC= gcc
CFLAGS= -Wall -g
TEST_CFLAGS= -g -Wno-unused-function
BENCH_FLAGS= -O2
SRC= $(wildcard src/*.c)
OBJS= $(subst .c,.o,$(SRC))
HEADERS= $(wildcard src/*.h)
LDFLAGS= -shared
LIBTOOL= libtool
PY= python
TESTSRC= $(wildcard tests/**/*.c)
CLARSRC = $(wildcard tests/*.c)
all: $(SRC) $(PROGRAM_NAME)
$(PROGRAM_NAME): $(OBJS) $(HEADERS)
$(CC) $(LDFLAGS) -o $@ $(OBJS)
print-% : ; @echo $* = $($*)
%.o : %.c
$(CC) -fPIC $(CFLAGS) -c $< -o $@
clean:
rm -rf src/*.o tests/*.o syslog.a tests/clar.suite tests/.clarcache
test: clar.suite $(PROGRAM_NAME) $(TESTSRC)
$(CC) -Itests/ -Isrc/ $(TEST_CFLAGS) $(SRC) $(CLARSRC) $(TESTSRC) -o runtests
./runtests
benchmark: $(PROGRAM_NAME) bench/benchmark.c
$(CC) -Isrc/ $(BENCH_FLAGS) $(SRC) bench/benchmark.c -o benchmark
install: $(PROGRAM_NAME)
$(LIBTOOL) --mode=install cp $(PROGRAM_NAME) /usr/local/lib/$(PROGRAM_NAME)
mkdir -p /usr/local/include/webmakersteve
cp src/syslog.h /usr/local/include/webmakersteve/syslog.h
clar.suite:
$(PY) tests/generate.py tests