-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (45 loc) · 1.65 KB
/
Makefile
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
PREFIX = /opt
CFLAGS = -g -Wall -Werror -Wextra -Iiniparser -Icritbit
PROGRAMS = ennodb
TESTS = tests
WEBSITE = $(PREFIX)/share/ennodb/www/
ifeq "$(CC)" "clang"
CFLAGS += -Wno-padded -Wno-sign-conversion
endif
# http://www.thinkplexx.com/learn/howto/build-chain/make-based/prevent-gnu-make-from-always-removing-files-it-says-things-like-rm-or-removing-intermediate-files
.SECONDARY: prefix.o
all: $(PROGRAMS) $(TESTS)
test: $(TESTS)
@./tests
%.o: %.c %.h
$(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES)
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES)
tests.o: tests.c
$(CC) $(CFLAGS) -DMOCKFCGI -o $@ -c $< $(INCLUDES)
%-test.o: %.c
$(CC) $(CFLAGS) -DMOCKFCGI -o $@ -c $< $(INCLUDES)
CuTest.o: critbit/CuTest.c
$(CC) $(CFLAGS) -Wno-format-nonliteral -o $@ -c $< $(INCLUDES)
critbit.o: critbit/critbit.c
$(CC) $(CFLAGS) -o $@ -c $< $(INCLUDES)
iniparser.o: iniparser/iniparser.c
$(CC) $(CFLAGS) -Wno-unused-macros -o $@ -c $< $(INCLUDES)
cgiapp.a: cgiapp.o critbit.o iniparser.o
$(AR) -q $@ $^
ennodb: ennodb.o nosql.o cgiapp.a
$(CC) $(CFLAGS) -o $@ $^ -lfcgi $(LDFLAGS)
tests: ennodb-test.o mockfcgi.o tests.o nosql.o critbit/test_critbit.o CuTest.o critbit.o iniparser.o
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f *~ *.a *.o */*.o $(PROGRAMS) $(TESTS)
install: $(PROGRAMS)
sudo mkdir -p $(PREFIX)/bin
sudo mkdir -p $(PREFIX)/share/doc/ennodb/examples
sudo mkdir -p /var/lib/ennodb /etc/ennodb $(WEBSITE)
sudo chown www-data.www-data /var/lib/ennodb
sudo install html/*.* $(WEBSITE)
sudo install $(PROGRAMS) $(PREFIX)/bin
sudo install etc/init.d/* /etc/init.d/
sudo install etc/ennodb/* /etc/ennodb/
sudo install doc/examples/* $(PREFIX)/share/doc/ennodb/examples/