blob: 119d82402dcde99e5028a44d2942284b03d00254 [file] [log] [blame]
Dragan Dosen59bb97a2017-06-02 12:03:16 +02001DESTDIR =
2PREFIX = /usr/local
3BINDIR = $(PREFIX)/bin
4
5CC = gcc
6LD = $(CC)
7
8CXX = g++
9
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
22CFLAGS = -g -Wall -pthread
23LDFLAGS = -lpthread -levent -levent_pthreads -lapr-1 -laprutil-1 -lstdc++
24INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC)
25LIBS =
26
27CXXFLAGS = -g -std=gnu++11
28CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
29
30SRCS = standalone.o spoa.o defender.o \
31 $(wildcard $(MOD_DEFENDER_SRC)/deps/libinjection/*.c)
32OBJS = $(patsubst %.c, %.o, $(SRCS))
33
34CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
35CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
36
37defender: $(OBJS) $(CXXOBJS)
38 $(LD) -o $@ $^ $(LDFLAGS) $(LIBS)
39
40install: defender
41 install defender $(DESTDIR)$(BINDIR)
42
43clean:
44 rm -f defender $(OBJS) $(CXXOBJS)
45
46%.o: %.c
47 $(CC) $(CFLAGS) $(INCS) -c -o $@ $<
48
49%.o: %.cpp
50 $(CXX) $(CXXFLAGS) $(CXXINCS) -c -o $@ $<