-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
executable file
·57 lines (36 loc) · 1.21 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
PBUF_IN_DIR=protobufs
PBUF_SRC:=$(wildcard $(PBUF_IN_DIR)/*.proto)
PBUF_OUT_DIR=packets
PBUF_OBJ=packets.o
FLAGS=-Wall -std=c++11
PBUF_LIB = /usr/lib/libprotobuf-lite.a
#-Wl,-Bstatic
LIBS= /usr/lib/libwolfssl.a $(PBUF_LIB) #-lwolfssl
KEMS_FOLDER = kems
SABER = $(wildcard ./$(KEMS_FOLDER)/saber/_static/*.a) $(wildcard ./$(KEMS_FOLDER)/saber/_common/*.o)
ALG_LIBS = $(SABER)
SRC:=$(wildcard *.cpp) $(wildcard *.hpp)
OUT_EXE=neptune
OBJ_FOLDER=obj
#SUBDIRS = foo bar baz
#subdirs:
# for dir in $(SUBDIRS); do \
# $(MAKE) -C $$dir; \
# done
# $(PBUF_IN_DIR)/*
# force
# make -B ...
all: compile_protobufs compile
protobufs: $(PBUF_SRC)
protoc -I=./$(PBUF_IN_DIR) --cpp_out=$(PBUF_OUT_DIR) $(PBUF_SRC)
PBUF_CC = $(wildcard $(PBUF_OUT_DIR)/*.pb.cc)
packets: protobufs $(PBUF_CC)
g++ $(FLAGS) -c $(PBUF_CC) -o $(OBJ_FOLDER)/$(PBUF_OBJ)
OBJ_FILES=$(wildcard $(OBJ_FOLDER)/*.o)
compile: $(SRC)
g++ $(FLAGS) $(SRC) $(OBJ_FILES) $(ALG_LIBS) $(LIBS) -o $(OUT_EXE)
run: compile
./$(OUT_EXE)
networking_test:
g++ $(FLAGS) networking/client.cpp $(OBJ_FOLDER)/$(PBUF_OBJ) -l protobuf -o networking/client
g++ $(FLAGS) networking/server.cpp $(OBJ_FOLDER)/$(PBUF_OBJ) -l protobuf -o networking/server