-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
72 lines (50 loc) · 2.43 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# define some Makefile variables for the compiler and compiler flags
# to use Makefile variables later in the Makefile: $()
#
export CC = g++
export CFLAGS = -g -Wall
export STD = -std=c++11
export AOSSL_LIBS = -laossl -luuid -lcurl -lbsoncxx -lmongocxx
export POCO_LIBS = -lPocoNetSSL -lPocoCrypto -lPocoNet -lPocoUtil -lPocoFoundation
export LIBS = $(AOSSL_LIBS) $(POCO_LIBS) -lboost_system -lpthread
INCL_DIRS = -I. -I$(CURDIR)/src/ -I/usr/local/include -I/usr/local/include/mongocxx/v_noabi -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/bsoncxx/v_noabi -I/usr/local/include/libbson-1.0
LINK_DIRS = -L/usr/local/lib
MODEL_SUB_OBJECTS = src/model/object/json_object.o src/model/property/json_property.o src/model/list/json_object_list.o src/model/list/json_property_list.o src/model/factory/json_factory.o
DB_SUB_OBJECTS = src/db/core_database_manager.o src/db/property_database_manager.o src/db/obj3_database_manager.o
SUB_OBJECTS = $(MODEL_SUB_OBJECTS) $(DB_SUB_OBJECTS)
INSTALL_CONFIG_DIR = /etc/clyman
INSTALL_LOG_DIR = /var/log/clyman
INSTALL_DIR = /usr/local/bin
.PHONY: mksrc test
# -------------------------- Central Targets --------------------------------- #
build: clyman
install: install_config install_controller install_service install_executable install_log
# ------------------------- Build Executable --------------------------------- #
clyman: mksrc
$(CC) $(CFLAGS) -o $@ main.cpp $(SUB_OBJECTS) $(LIBS) $(STD) $(INCL_DIRS) $(LINK_DIRS)
# ----------------------------- Submakes ------------------------------------- #
mksrc:
@$(MAKE) -C src
test: mksrc
@$(MAKE) -C tests
# -------------------------- Install Scripts --------------------------------- #
install_config: mk_config_dir
cp release/app.properties $INSTALL_CONFIG_DIR/app.properties
mk_config_dir:
mkdir -p $INSTALL_CONFIG_DIR
install_controller:
cp scripts/linux/clyman_controller.sh $INSTALL_DIR/clyman_controller.sh
install_service:
cp clyman.service /etc/systemd/system/clyman.service
install_executable:
cp clyman $INSTALL_DIR/clyman
install_log:
mkdir /var/log/clyman
# --------------------------- Clean Project ---------------------------------- #
clean:
rm clyman src/*/*.o src/*/*/*.o tests/tests
reset: clean
rm tests/test_main.o
# ------------------------- Uninstall Project -------------------------------- #
uninstall:
rm $INSTALL_CONFIG_DIR/app.properties $INSTALL_DIR/clyman_controller.sh /etc/systemd/system/clyman.service $INSTALL_DIR/clyman