1
0
mirror of https://git.kore.io/kore.git synced 2024-11-12 05:10:48 +01:00
kore/Makefile

96 lines
2.0 KiB
Makefile
Raw Normal View History

2013-04-17 22:34:27 +02:00
# Kore Makefile
2014-10-22 17:02:25 +02:00
CC?=gcc
PREFIX?=/usr/local
2014-08-01 10:46:50 +02:00
KORE=kore
INSTALL_DIR=$(PREFIX)/bin
INCLUDE_DIR=$(PREFIX)/include/kore
2013-04-17 22:34:27 +02:00
S_SRC= src/kore.c src/buf.c src/cli.c src/config.c src/connection.c \
src/domain.c src/mem.c src/msg.c src/module.c src/net.c \
src/pool.c src/timer.c src/utils.c src/worker.c
2013-04-17 22:34:27 +02:00
S_OBJS= $(S_SRC:.c=.o)
CFLAGS+=-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes
2013-04-17 22:34:27 +02:00
CFLAGS+=-Wmissing-declarations -Wshadow -Wpointer-arith -Wcast-qual
CFLAGS+=-Wsign-compare -Iincludes -std=c99 -pedantic
CFLAGS+=-DPREFIX='"$(PREFIX)"'
LDFLAGS=-rdynamic -lssl -lcrypto
2013-11-21 12:00:07 +01:00
ifneq ("$(DEBUG)", "")
CFLAGS+=-DKORE_DEBUG -g
2016-02-13 14:21:09 +01:00
NOOPT=1
endif
ifneq ("$(NOOPT)", "")
CFLAGS+=-O0
else
CFLAGS+=-O2
endif
ifneq ("$(NOHTTP)", "")
CFLAGS+=-DKORE_NO_HTTP
else
S_SRC+= src/auth.c src/accesslog.c src/http.c \
2015-12-04 14:11:37 +01:00
src/validator.c src/websocket.c
endif
ifneq ("$(NOTLS)", "")
CFLAGS+=-DKORE_NO_TLS
ifneq ("$(NOHTTP)", "")
LDFLAGS=-rdynamic
else
LDFLAGS=-rdynamic -lcrypto
endif
endif
ifneq ("$(PGSQL)", "")
S_SRC+=src/pgsql.c
2014-04-02 00:06:24 +02:00
LDFLAGS+=-L$(shell pg_config --libdir) -lpq
CFLAGS+=-I$(shell pg_config --includedir) -DKORE_USE_PGSQL \
-DPGSQL_INCLUDE_PATH="\"$(shell pg_config --includedir)\""
endif
ifneq ("$(TASKS)", "")
S_SRC+=src/tasks.c
LDFLAGS+=-lpthread
CFLAGS+=-DKORE_USE_TASKS
endif
OSNAME=$(shell uname -s | sed -e 's/[-_].*//g' | tr A-Z a-z)
ifeq ("$(OSNAME)", "darwin")
CFLAGS+=-I/opt/local/include/ -I/usr/local/opt/openssl/include
LDFLAGS+=-L/opt/local/lib -L/usr/local/opt/openssl/lib
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
2015-07-25 19:10:48 +02:00
$(KORE): $(S_OBJS)
2014-08-02 13:01:58 +02:00
$(CC) $(S_OBJS) $(LDFLAGS) -o $(KORE)
2013-04-17 22:34:27 +02:00
2015-07-25 19:10:48 +02:00
all: $(KORE)
2014-07-03 21:38:16 +02:00
install:
mkdir -p $(INCLUDE_DIR)
mkdir -p $(INSTALL_DIR)
2014-08-01 10:46:50 +02:00
install -m 555 $(KORE) $(INSTALL_DIR)/$(KORE)
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)
rm -rf $(INCLUDE_DIR)
2014-07-03 21:38:16 +02:00
.c.o:
2013-04-17 22:34:27 +02:00
$(CC) $(CFLAGS) -c $< -o $@
clean:
find . -type f -name \*.o -exec rm {} \;
rm -f $(KORE)
2015-07-25 19:10:48 +02:00
.PHONY: all clean