blob: ac17774d3e557d9e63647c33c38f54986a335228 [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
31LDFLAGS += -lpthread $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
32INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) -I$(EVENT_INC)
Dragan Dosen59bb97a2017-06-02 12:03:16 +020033LIBS =
34
35CXXFLAGS = -g -std=gnu++11
36CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
37
38SRCS = standalone.o spoa.o defender.o \
39 $(wildcard $(MOD_DEFENDER_SRC)/deps/libinjection/*.c)
40OBJS = $(patsubst %.c, %.o, $(SRCS))
41
42CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
43CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
44
45defender: $(OBJS) $(CXXOBJS)
46 $(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
47
48install: defender
49 install defender $(DESTDIR)$(BINDIR)
50
51clean:
52 rm -f defender $(OBJS) $(CXXOBJS)
53
54%.o: %.c
55 $(CC) $(CFLAGS) $(INCS) -c -o $@ $<
56
57%.o: %.cpp
58 $(CXX) $(CXXFLAGS) $(CXXINCS) -c -o $@ $<