Update makefile with some libraries compiled separately
This commit is contained in:
50
Makefile
50
Makefile
@@ -1,22 +1,50 @@
|
||||
CFLAGS=-Wall -Wextra -ggdb
|
||||
|
||||
LIBWS=./vendor/libmicrohttpd/
|
||||
LIBWS_LIB=$(LIBWS)lib/libmicrohttpd.a
|
||||
|
||||
LIBSHA=./vendor/sha256/
|
||||
LIBSHA_SRC=$(LIBSHA)sha256.c
|
||||
|
||||
LDFLAGS=-lm -luuid
|
||||
INCL_FLAGS=-I$(LIBWS)include -I$(LIBSHA)
|
||||
SHARED_LIB_FILES=output/libpath.a output/libnoh.a output/libsha.a
|
||||
SHARED_LIBS=-L./output -lsha -lpath -lnoh
|
||||
|
||||
server: src/server.c $(LIBSHA_SRC) output
|
||||
gcc $(CFLAGS) $(INCL_FLAGS) -o output/server src/server.c $(LIBSHA_SRC) $(LIBWS_LIB) $(LDFLAGS)
|
||||
################################################################################
|
||||
|
||||
LDFLAGS2=-lm
|
||||
INCL_FLAGS2=-I$(LIBSHA)
|
||||
SERVER_LDFLAGS=-lm -luuid -L $(LIBWS)lib -lmicrohttpd $(SHARED_LIBS)
|
||||
SERVER_INCL_FLAGS=-I$(LIBWS)include -I$(LIBSHA)
|
||||
|
||||
userctl: src/userctl.c $(LIBSHA_SRC) output
|
||||
gcc $(CFLAGS) $(INCL_FLAGS2) -o output/userctl src/userctl.c $(LIBSHA_SRC) $(LDFLAGS2)
|
||||
SERVER_SRC=src/server.c src/users.c \
|
||||
src/id_store.c src/library.c \
|
||||
src/opds_handler.c src/get_handler.c
|
||||
|
||||
server: output/server
|
||||
output/server: $(SERVER_SRC) $(SHARED_LIB_FILES) | output
|
||||
gcc $(CFLAGS) $(SERVER_INCL_FLAGS) -o output/server src/server.c $(SERVER_LDFLAGS)
|
||||
|
||||
################################################################################
|
||||
|
||||
USERCTL_LDFLAGS=-lm $(SHARED_LIBS)
|
||||
USERCTL_INCL_FLAGS=-I$(LIBSHA)
|
||||
|
||||
USERCTL_SRC=src/userctl.c src/users.c
|
||||
|
||||
userctl: output/userctl
|
||||
output/userctl: $(USERCTL_SRC) $(SHARED_LIB_FILES) | output
|
||||
gcc $(CFLAGS) $(USERCTL_INCL_FLAGS) -o output/userctl src/userctl.c $(USERCTL_LDFLAGS)
|
||||
|
||||
################################################################################
|
||||
|
||||
output/libsha.a: $(LIBSHA)sha256.c $(LIBSHA)sha256.h | output
|
||||
gcc $(CFLAGS) -c -o output/sha.o $(LIBSHA)sha256.c
|
||||
ar rcsD output/libsha.a output/sha.o
|
||||
|
||||
output/libpath.a: src/path.c src/path.h | output
|
||||
gcc $(CFLAGS) -x c -c -o output/path.o src/path.c -L ./output -lnoh
|
||||
ar rcsD output/libpath.a output/path.o
|
||||
|
||||
output/libnoh.a: src/noh.h | output
|
||||
gcc $(CFLAGS) -x c -c -o output/noh.o src/noh.h -DNOH_IMPLEMENTATION
|
||||
ar rcsD output/libnoh.a output/noh.o
|
||||
|
||||
################################################################################
|
||||
|
||||
output:
|
||||
mkdir -p output
|
||||
|
||||
Reference in New Issue
Block a user