blob: efc7d7f6e18e2742b0fbbc37d980879981635293 [file] [log] [blame]
Dragan Dosen59bb97a2017-06-02 12:03:16 +02001DESTDIR =
2PREFIX = /usr/local
3BINDIR = $(PREFIX)/bin
4
David Carlier80ebd302017-06-07 12:39:16 +01005CC ?= gcc
Dragan Dosen59bb97a2017-06-02 12:03:16 +02006LD = $(CC)
7
David Carlier80ebd302017-06-07 12:39:16 +01008CXX ?= g++
Dragan Dosen59bb97a2017-06-02 12:03:16 +02009
10ifeq ($(MOD_DEFENDER_SRC),)
11MOD_DEFENDER_SRC := ./mod_defender_src
12endif
13
14ifeq ($(APACHE2_INC),)
15APACHE2_INC := /usr/include/apache2
16endif
17
18ifeq ($(APR_INC),)
19APR_INC := /usr/include/apr-1.0
20endif
21
David Carlier80ebd302017-06-07 12:39:16 +010022ifeq ($(EVENT_LIB),)
23EVENT_LIB := -levent
24endif
25
26ifeq ($(EVENT_INC),)
27EVENT_INC := /usr/include
28endif
29
30CFLAGS += -g -Wall -pthread
David Carlier80ebd302017-06-07 12:39:16 +010031INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) -I$(EVENT_INC)
Christian Ruppert57dc2832017-11-30 10:11:36 +010032LIBS += -lpthread $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
Dragan Dosen59bb97a2017-06-02 12:03:16 +020033
34CXXFLAGS = -g -std=gnu++11
35CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
36
37SRCS = standalone.o spoa.o defender.o \
38 $(wildcard $(MOD_DEFENDER_SRC)/deps/libinjection/*.c)
39OBJS = $(patsubst %.c, %.o, $(SRCS))
40
41CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
42CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
43
44defender: $(OBJS) $(CXXOBJS)
Christian Ruppert57dc2832017-11-30 10:11:36 +010045 $(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
Dragan Dosen59bb97a2017-06-02 12:03:16 +020046
47install: defender
48 install defender $(DESTDIR)$(BINDIR)
49
50clean:
51 rm -f defender $(OBJS) $(CXXOBJS)
52
53%.o: %.c
54 $(CC) $(CFLAGS) $(INCS) -c -o $@ $<
55
56%.o: %.cpp
57 $(CXX) $(CXXFLAGS) $(CXXINCS) -c -o $@ $<