Dragan Dosen | 59bb97a | 2017-06-02 12:03:16 +0200 | [diff] [blame] | 1 | DESTDIR = |
| 2 | PREFIX = /usr/local |
| 3 | BINDIR = $(PREFIX)/bin |
| 4 | |
| 5 | CC = gcc |
| 6 | LD = $(CC) |
| 7 | |
| 8 | CXX = g++ |
| 9 | |
| 10 | ifeq ($(MOD_DEFENDER_SRC),) |
| 11 | MOD_DEFENDER_SRC := ./mod_defender_src |
| 12 | endif |
| 13 | |
| 14 | ifeq ($(APACHE2_INC),) |
| 15 | APACHE2_INC := /usr/include/apache2 |
| 16 | endif |
| 17 | |
| 18 | ifeq ($(APR_INC),) |
| 19 | APR_INC := /usr/include/apr-1.0 |
| 20 | endif |
| 21 | |
| 22 | CFLAGS = -g -Wall -pthread |
| 23 | LDFLAGS = -lpthread -levent -levent_pthreads -lapr-1 -laprutil-1 -lstdc++ |
| 24 | INCS += -I../../include -I../../ebtree -I$(MOD_DEFENDER_SRC) -I$(APACHE2_INC) -I$(APR_INC) |
| 25 | LIBS = |
| 26 | |
| 27 | CXXFLAGS = -g -std=gnu++11 |
| 28 | CXXINCS += -I$(MOD_DEFENDER_SRC) -I$(MOD_DEFENDER_SRC)/deps -I$(APACHE2_INC) -I$(APR_INC) |
| 29 | |
| 30 | SRCS = standalone.o spoa.o defender.o \ |
| 31 | $(wildcard $(MOD_DEFENDER_SRC)/deps/libinjection/*.c) |
| 32 | OBJS = $(patsubst %.c, %.o, $(SRCS)) |
| 33 | |
| 34 | CXXSRCS = $(wildcard $(MOD_DEFENDER_SRC)/*.cpp) |
| 35 | CXXOBJS = $(patsubst %.cpp, %.o, $(CXXSRCS)) |
| 36 | |
| 37 | defender: $(OBJS) $(CXXOBJS) |
| 38 | $(LD) -o $@ $^ $(LDFLAGS) $(LIBS) |
| 39 | |
| 40 | install: defender |
| 41 | install defender $(DESTDIR)$(BINDIR) |
| 42 | |
| 43 | clean: |
| 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 $@ $< |