2017-06-02 10:03:16 +00:00
|
|
|
DESTDIR =
|
|
|
|
PREFIX = /usr/local
|
|
|
|
BINDIR = $(PREFIX)/bin
|
|
|
|
|
2017-06-07 11:39:16 +00:00
|
|
|
CC ?= gcc
|
2017-06-02 10:03:16 +00:00
|
|
|
LD = $(CC)
|
|
|
|
|
2017-06-07 11:39:16 +00:00
|
|
|
CXX ?= g++
|
2017-06-02 10:03:16 +00:00
|
|
|
|
|
|
|
ifeq ($(MOD_DEFENDER_SRC),)
|
|
|
|
MOD_DEFENDER_SRC := ./mod_defender_src
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(APACHE2_INC),)
|
|
|
|
APACHE2_INC := /usr/include/apache2
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(APR_INC),)
|
|
|
|
APR_INC := /usr/include/apr-1.0
|
|
|
|
endif
|
|
|
|
|
2017-06-07 11:39:16 +00:00
|
|
|
ifeq ($(EVENT_LIB),)
|
|
|
|
EVENT_LIB := -levent
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(EVENT_INC),)
|
|
|
|
EVENT_INC := /usr/include
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += -g -Wall -pthread
|
|
|
|
INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) -I$(EVENT_INC)
|
2017-11-30 09:11:36 +00:00
|
|
|
LIBS += -lpthread $(EVENT_LIB) -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ -lm
|
2017-06-02 10:03:16 +00:00
|
|
|
|
|
|
|
CXXFLAGS = -g -std=gnu++11
|
|
|
|
CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC)
|
|
|
|
|
|
|
|
SRCS = standalone.o spoa.o defender.o \
|
|
|
|
$(wildcard $(MOD_DEFENDER_SRC)/deps/libinjection/*.c)
|
|
|
|
OBJS = $(patsubst %.c, %.o, $(SRCS))
|
|
|
|
|
|
|
|
CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp)
|
|
|
|
CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS))
|
|
|
|
|
|
|
|
defender: $(OBJS) $(CXXOBJS)
|
2017-11-30 09:11:36 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
|
2017-06-02 10:03:16 +00:00
|
|
|
|
|
|
|
install: defender
|
|
|
|
install defender $(DESTDIR)$(BINDIR)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f defender $(OBJS) $(CXXOBJS)
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(INCS) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) $(CXXINCS) -c -o $@ $<
|