2022-05-20 19:06:26 +02:00
|
|
|
# Compiler Settings
|
|
|
|
CC=cc
|
2022-06-19 17:19:36 +02:00
|
|
|
CFLAGS=-Wall -Wextra -Werror -Wcomment -Wformat -Wformat-security -Wmain -Wnonnull -Wunused -std=c11
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
# Source Code
|
2022-11-18 16:10:20 +01:00
|
|
|
SRC_CORE=./src/core/lib/*.c
|
|
|
|
SRC_CORE_APP=./src/core/app/*.c
|
2022-11-18 16:30:55 +01:00
|
|
|
SRC_LOGGER=./src/logger/lib/*.c
|
2022-11-18 16:20:01 +01:00
|
|
|
|
2022-11-17 14:04:03 +01:00
|
|
|
INCLUDE_DIR=./include
|
2022-11-18 16:16:11 +01:00
|
|
|
INCLUDE_CORE=$(INCLUDE_DIR)/*.h
|
2022-11-18 16:20:01 +01:00
|
|
|
INCLUDE_LOGGER=$(INCLUDE_DIR)/logger/*.h
|
|
|
|
|
2022-11-18 16:28:57 +01:00
|
|
|
TEST_CORE=./src/core/lib/test/main.c
|
2022-11-18 16:26:56 +01:00
|
|
|
LIBS_CORE=-ljson-c -lcurl -lgit2
|
2022-05-20 19:06:26 +02:00
|
|
|
|
2022-11-18 16:32:02 +01:00
|
|
|
LIBS_LOGGER=-lwhy2
|
|
|
|
|
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-28 17:45:39 +02:00
|
|
|
noTarget: # Do not use this, please <3
|
|
|
|
@echo Hey you... You have to enter your target, too. Use \'install\' target for installing $(PROJECT_NAME)-core.
|
|
|
|
|
2022-11-18 16:19:21 +01:00
|
|
|
installHeaderCore:
|
2022-11-18 16:16:11 +01:00
|
|
|
for file in $(INCLUDE_CORE); do install -m 755 -D $(DOLLAR)file -t $(INSTALL_INCLUDE)/$(PROJECT_NAME); done
|
2022-11-18 13:03:50 +01:00
|
|
|
ln -sf $(INSTALL_INCLUDE)/$(PROJECT_NAME)/$(PROJECT_NAME).h $(INSTALL_INCLUDE)/$(PROJECT_NAME).h
|
2022-06-11 16:30:19 +02:00
|
|
|
|
2022-11-18 16:23:23 +01:00
|
|
|
installHeaderLogger:
|
|
|
|
for file in $(INCLUDE_LOGGER); do install -m 755 -D $(DOLLAR)file -t $(INSTALL_INCLUDE)/$(PROJECT_NAME)/logger; done
|
|
|
|
|
2022-11-18 16:24:47 +01:00
|
|
|
buildLibCore:
|
2022-11-18 16:10:20 +01:00
|
|
|
$(CC) $(CFLAGS) -fPIC -c $(SRC_CORE)
|
2022-11-18 16:26:56 +01:00
|
|
|
$(CC) $(CFLAGS) -shared -o lib$(PROJECT_NAME).so *.o $(LIBS_CORE)
|
2022-11-18 16:01:41 +01:00
|
|
|
|
2022-11-18 16:33:07 +01:00
|
|
|
buildLibLogger:
|
|
|
|
$(CC) $(CFLAGS) -fPIC -c $(SRC_LOGGER)
|
|
|
|
$(CC) $(CFLAGS) -shared -o lib$(PROJECT_NAME)-logger.so *.o $(LIBS_LOGGER)
|
|
|
|
|
2022-11-18 16:25:17 +01:00
|
|
|
installLibCore: buildLibCore
|
2022-11-17 14:04:03 +01:00
|
|
|
install -m 755 ./lib$(PROJECT_NAME).so $(INSTALL_LIBRARY)/lib$(PROJECT_NAME).so
|
2022-06-01 17:40:52 +02:00
|
|
|
|
2022-11-18 16:25:33 +01:00
|
|
|
installAppCore: app
|
2022-05-20 19:06:26 +02:00
|
|
|
install -m 755 $(OUTPUT_APP) $(INSTALL_BIN)/$(PROJECT_NAME)
|
|
|
|
|
2022-11-18 16:34:10 +01:00
|
|
|
installLibLogger: buildLibLogger
|
|
|
|
install -m 755 ./lib$(PROJECT_NAME)-logger.so $(INSTALL_LIBRARY)/lib$(PROJECT_NAME)-logger.so
|
|
|
|
|
2022-11-18 16:40:25 +01:00
|
|
|
testCore:
|
2022-11-18 16:27:52 +01:00
|
|
|
$(CC) $(CFLAGS) -g $(TEST_CORE) -o $(OUTPUT_TEST) -l$(PROJECT_NAME)
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
app:
|
2022-11-18 16:10:20 +01:00
|
|
|
$(CC) $(CFLAGS) $(SRC_CORE_APP) -o $(OUTPUT_APP) -l$(PROJECT_NAME)
|
2022-05-20 19:06:26 +02:00
|
|
|
|
|
|
|
clean:
|
2022-06-01 17:32:27 +02:00
|
|
|
rm -rf $(OUTPUT)/* *.o *.so
|
|
|
|
|
2022-11-18 16:23:46 +01:00
|
|
|
installHeader: installHeaderCore installHeaderLogger
|
2022-11-18 16:35:22 +01:00
|
|
|
install: installHeader installLibCore clean installLibLogger installAppCore clean
|
2022-11-18 16:40:25 +01:00
|
|
|
installTest: install testCore
|
2022-07-29 17:33:37 +02:00
|
|
|
all: install
|