Refactor for shared library use
This commit is contained in:
23
Makefile
23
Makefile
@ -1,19 +1,28 @@
|
||||
.DEFAULT_GOAL := install
|
||||
|
||||
CFLAGS=-std=c11 -Wall
|
||||
INCLUDE=-lssl -lcrypto -lmagic -lz -lmaxminddb
|
||||
LIBS=src/lib/*.c
|
||||
|
||||
packages:
|
||||
@echo "Installing packages..."
|
||||
sudo apt-get install gcc libmagic-dev libssl-dev php-fpm
|
||||
sudo apt install gcc php-fpm libmagic-dev libssl-dev libmaxminddb-dev
|
||||
@echo "Finished downloading!"
|
||||
|
||||
permit:
|
||||
sudo setcap 'cap_net_bind_service=+ep' "$(shell pwd)/bin/necronda-server"
|
||||
|
||||
compile:
|
||||
@mkdir -p bin
|
||||
gcc src/necronda-server.c -o bin/necronda-server -std=c11 -lssl -lcrypto -lmagic -lz -lmaxminddb -Wall
|
||||
gcc $(LIBS) -o bin/libnecronda-server.so --shared -fPIC $(CFLAGS) $(INCLUDE)
|
||||
gcc src/necronda-server.c -o bin/necronda-server $(CFLAGS) $(INCLUDE) \
|
||||
-Lbin -lnecronda-server \
|
||||
-Wl,-rpath=$(shell pwd)/bin
|
||||
|
||||
compile-debian:
|
||||
@mkdir -p bin
|
||||
gcc src/necronda-server.c -o bin/necronda-server -std=c11 -lssl -lcrypto -lmagic -lz -lmaxminddb -Wall \
|
||||
gcc $(LIBS) -o bin/libnecronda-server.so --shared -fPIC $(CFLAGS) $(INCLUDE)
|
||||
gcc src/necronda-server.c -o bin/necronda-server $(CFLAGS) $(INCLUDE) \
|
||||
-Lbin -lnecronda-server \
|
||||
-Wl,-rpath=$(shell pwd)/bin \
|
||||
-D MAGIC_FILE="\"/usr/share/file/magic.mgc\"" \
|
||||
-D PHP_FPM_SOCKET="\"/var/run/php/php7.3-fpm.sock\""
|
||||
|
||||
install: | packages compile
|
||||
@echo "Finished!"
|
||||
|
Reference in New Issue
Block a user