2022-05-20 19:06:26 +02:00
|
|
|
# Compiler Settings
|
|
|
|
CC=cc
|
2022-06-11 17:46:59 +02:00
|
|
|
CFLAGS=-Wall -std=c11
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
# Source Code
|
|
|
|
SRC=src/lib/*.c
|
|
|
|
SRC_APP=src/app/*.c
|
|
|
|
INCLUDE_DIR="include"
|
|
|
|
INCLUDE=$(INCLUDE_DIR)/*.h
|
|
|
|
TEST=src/lib/test/main.c
|
2022-06-11 17:13:27 +02:00
|
|
|
LIBS=-ljson-c -lcurl -lgit2
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
# Output Files
|
|
|
|
PROJECT_NAME=why2
|
|
|
|
OUTPUT=out
|
|
|
|
OUTPUT_TEST=$(OUTPUT)/$(PROJECT_NAME)-test
|
|
|
|
OUTPUT_APP=$(OUTPUT)/$(PROJECT_NAME)-app
|
|
|
|
|
|
|
|
# Install Files
|
|
|
|
INSTALL_INCLUDE=/usr/include
|
|
|
|
INSTALL_LIBRARY=/usr/lib
|
|
|
|
INSTALL_BIN=/usr/bin
|
|
|
|
|
|
|
|
# Misc
|
|
|
|
DOLLAR=$
|
|
|
|
|
|
|
|
##########
|
|
|
|
|
2022-06-11 16:30:19 +02:00
|
|
|
installHeader:
|
2022-05-20 19:06:26 +02:00
|
|
|
for file in $(INCLUDE); do install -m 755 -D $(DOLLAR)file -t $(INSTALL_INCLUDE)/$(PROJECT_NAME); done
|
|
|
|
install -m 755 $(INCLUDE_DIR)/$(PROJECT_NAME).h $(INSTALL_INCLUDE)/$(PROJECT_NAME).h
|
2022-06-11 16:30:19 +02:00
|
|
|
|
|
|
|
installLib:
|
2022-05-20 19:06:26 +02:00
|
|
|
$(CC) $(CFLAGS) -fPIC -c $(SRC)
|
|
|
|
$(CC) $(CFLAGS) -shared -o lib$(PROJECT_NAME).so *.o $(LIBS)
|
|
|
|
install -m 755 lib$(PROJECT_NAME).so $(INSTALL_LIBRARY)/lib$(PROJECT_NAME).so
|
2022-06-01 17:40:52 +02:00
|
|
|
|
|
|
|
installApp: app
|
2022-05-20 19:06:26 +02:00
|
|
|
install -m 755 $(OUTPUT_APP) $(INSTALL_BIN)/$(PROJECT_NAME)
|
|
|
|
|
|
|
|
test:
|
2022-06-13 18:48:23 +02:00
|
|
|
$(CC) $(CFLAGS) -g $(TEST) -o $(OUTPUT_TEST) -l$(PROJECT_NAME)
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
app:
|
|
|
|
$(CC) $(CFLAGS) $(SRC_APP) -o $(OUTPUT_APP) -l$(PROJECT_NAME)
|
|
|
|
|
|
|
|
clean:
|
2022-06-01 17:32:27 +02:00
|
|
|
rm -rf $(OUTPUT)/* *.o *.so
|
|
|
|
|
2022-06-01 17:40:52 +02:00
|
|
|
all: install
|
|
|
|
installTest: install test
|
2022-06-11 16:30:19 +02:00
|
|
|
install: installHeader installLib installApp clean
|