forked from tvelliott/charon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (59 loc) · 2.24 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
73
74
75
NAME ?= charon
SUFFIX ?= .c
DIRS ?= .
ARCH=arm
VIVADO_SETTINGS ?= /opt/Xilinx/Vivado/2018.2/settings64.sh
HAVE_VIVADO= $(shell bash -c "source $(VIVADO_SETTINGS) > /dev/null 2>&1 && vivado -version > /dev/null 2>&1 && echo 1 || echo 0")
FLAGS ?= -O3 -std=c99 -I../buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/usr/include/\
--sysroot=../buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/\
-I./third_party/libtuntap/ -mfloat-abi=hard
SYSROOT ?= ../buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/
LDFLAGS ?= --sysroot=/opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/ \
-L ../buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot/\
-L /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/ \
-L /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/lib \
-L /opt/Xilinx/SDK/2018.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/lib \
-L ./third_party/libfec\
-L ./third_party/libtuntap\
-L$(SYSROOT) -L$(SYSROOT)lib -L$(SYSROOT)usr -L$(SYSROOT)usr/lib \
-lliquid -liio -lad9361 -lc -lm -lfftw3 -lfftw3f -lini -lusb-1.0 -lserialport -lavahi-client -lavahi-common -lxml2 -lz -ldbus-1 -lfec -ltuntap
PLATFORM := $(shell uname -s)
-include Make.config
OUT_DIR := .build
SRC := $(foreach dir, $(DIRS), $(wildcard $(dir)/*$(SUFFIX)))
OBJ_ := $(SRC:$(SUFFIX)=.o)
OBJ := $(addprefix $(OUT_DIR)/,$(OBJ_))
DEPS := $(OBJ:.o=.d)
SHARED_SUFFIX := dll
STATIC_SUFFIX := lib
ifeq "$(PLATFORM)" "Linux"
SHARED_SUFFIX := so
STATIC_SUFFIX := a
endif
ifeq "$(LIBRARY)" "shared"
OUT=lib$(NAME).$(SHARED_SUFFIX)
LDFLAGS += -shared
else ifeq "$(LIBRARY)" "static"
OUT=lib$(NAME).$(STATIC_SUFFIX)
else
OUT=$(NAME)
endif
ifeq "$(SUFFIX)" ".cpp"
COMPILER := $(CXX)
else ifeq "$(SUFFIX)" ".c"
COMPILER := $(CROSS_COMPILE)gcc
endif
.SUFFIXES:
.PHONY: clean
$(OUT): $(OBJ)
ifeq "$(LIBRARY)" "static"
@$(AR) rcs $@ $^
else
@$(COMPILER) $^ $(LDFLAGS) -o $@
endif
$(OUT_DIR)/%.o: %$(SUFFIX)
@mkdir -p $(dir $@)
@$(COMPILER) $(CXXFLAGS) $(FLAGS) -MMD -MP -fPIC -c $< -o $@
clean:
@$(RM) -r $(OUT) $(OUT_DIR)
-include: $(DEPS)