2013-04-17 22:34:27 +02:00
|
|
|
# Kore Makefile
|
|
|
|
|
2013-04-21 20:21:46 +02:00
|
|
|
CC=gcc
|
2014-08-01 10:46:50 +02:00
|
|
|
KORE=kore
|
2014-07-03 21:38:16 +02:00
|
|
|
INSTALL_DIR=/usr/local/bin
|
2014-07-03 22:39:16 +02:00
|
|
|
INCLUDE_DIR=/usr/local/include/kore
|
2013-04-17 22:34:27 +02:00
|
|
|
|
2014-08-01 13:59:47 +02:00
|
|
|
S_SRC= src/kore.c src/accesslog.c src/auth.c src/buf.c src/cli.c src/config.c \
|
2014-01-22 22:55:10 +01:00
|
|
|
src/connection.c src/domain.c src/http.c src/mem.c src/module.c \
|
|
|
|
src/net.c src/pool.c src/spdy.c src/validator.c src/utils.c \
|
|
|
|
src/worker.c src/zlib_dict.c
|
2013-04-17 22:34:27 +02:00
|
|
|
S_OBJS= $(S_SRC:.c=.o)
|
|
|
|
|
|
|
|
CFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes
|
|
|
|
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
|
2013-06-17 23:39:17 +02:00
|
|
|
CFLAGS+=-Wsign-compare -Iincludes -g
|
2013-06-26 19:05:54 +02:00
|
|
|
LDFLAGS+=-rdynamic -lssl -lcrypto -lz
|
2013-06-17 23:39:17 +02:00
|
|
|
|
2013-11-21 12:00:07 +01:00
|
|
|
ifneq ("$(DEBUG)", "")
|
2013-11-16 13:30:47 +01:00
|
|
|
CFLAGS+=-DKORE_DEBUG
|
|
|
|
endif
|
|
|
|
|
2014-04-22 12:46:23 +02:00
|
|
|
ifneq ("$(KORE_PEDANTIC_MALLOC)", "")
|
|
|
|
CFLAGS+=-DKORE_PEDANTIC_MALLOC
|
|
|
|
endif
|
|
|
|
|
2014-08-01 10:22:32 +02:00
|
|
|
ifneq ("$(BENCHMARK)", "")
|
|
|
|
CFLAGS+=-DKORE_BENCHMARK
|
|
|
|
LDFLAGS=-rdynamic -lz
|
|
|
|
endif
|
|
|
|
|
2014-03-30 23:54:35 +02:00
|
|
|
ifneq ("$(PGSQL)", "")
|
2014-07-02 12:19:38 +02:00
|
|
|
S_SRC+=src/pgsql.c
|
2014-04-02 00:06:24 +02:00
|
|
|
LDFLAGS+=-L$(shell pg_config --libdir) -lpq
|
2014-08-03 17:33:40 +02:00
|
|
|
CFLAGS+=-I$(shell pg_config --includedir) -DKORE_USE_PGSQL \
|
|
|
|
-DPGSQL_INCLUDE_PATH="\"$(shell pg_config --includedir)\""
|
2014-03-30 23:54:35 +02:00
|
|
|
endif
|
|
|
|
|
2014-06-28 16:17:18 +02:00
|
|
|
ifneq ("$(TASKS)", "")
|
2014-07-02 12:19:38 +02:00
|
|
|
S_SRC+=src/tasks.c
|
2014-06-28 16:17:18 +02:00
|
|
|
LDFLAGS+=-lpthread
|
|
|
|
CFLAGS+=-DKORE_USE_TASKS
|
|
|
|
endif
|
|
|
|
|
2013-11-16 12:41:58 +01:00
|
|
|
OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
|
|
|
|
ifeq ("$(OSNAME)", "darwin")
|
2014-10-13 11:53:56 +02:00
|
|
|
CFLAGS+=-I/opt/local/include/ -I/usr/local/opt/openssl/include
|
|
|
|
LDFLAGS+=-L/opt/local/lib -L/usr/local/opt/openssl/lib
|
2013-11-16 12:41:58 +01:00
|
|
|
S_SRC+=src/bsd.c
|
|
|
|
else ifeq ("$(OSNAME)", "linux")
|
|
|
|
CFLAGS+=-D_GNU_SOURCE=1
|
|
|
|
LDFLAGS+=-ldl
|
|
|
|
S_SRC+=src/linux.c
|
|
|
|
else
|
|
|
|
S_SRC+=src/bsd.c
|
|
|
|
endif
|
|
|
|
|
2014-08-01 13:59:47 +02:00
|
|
|
all: $(S_OBJS)
|
2014-08-02 13:01:58 +02:00
|
|
|
$(CC) $(S_OBJS) $(LDFLAGS) -o $(KORE)
|
2013-04-17 22:34:27 +02:00
|
|
|
|
2014-07-03 21:38:16 +02:00
|
|
|
install:
|
2014-07-03 22:39:16 +02:00
|
|
|
mkdir -p $(INCLUDE_DIR)
|
2014-08-01 10:46:50 +02:00
|
|
|
install -m 555 $(KORE) $(INSTALL_DIR)/$(KORE)
|
2014-07-03 22:39:16 +02:00
|
|
|
install -m 644 includes/*.h $(INCLUDE_DIR)
|
2014-07-03 21:38:16 +02:00
|
|
|
|
|
|
|
uninstall:
|
2014-08-01 10:46:50 +02:00
|
|
|
rm -f $(INSTALL_DIR)/$(KORE)
|
2014-07-03 22:39:16 +02:00
|
|
|
rm -rf $(INCLUDE_DIR)
|
2014-07-03 21:38:16 +02:00
|
|
|
|
2013-06-17 23:39:17 +02:00
|
|
|
.c.o:
|
2013-04-17 22:34:27 +02:00
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
clean:
|
2014-03-30 23:54:35 +02:00
|
|
|
find . -type f -name \*.o -exec rm {} \;
|
2014-08-01 13:59:47 +02:00
|
|
|
rm -f $(KORE)
|
2013-11-16 12:41:58 +01:00
|
|
|
|
|
|
|
.PHONY: clean
|