-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
65 lines (54 loc) · 2.16 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
# The Compiler: gcc for C, g++ for C++
CC := g++
NAME := BACnetVirtualDevicesServerExampleCPP_linux_x64_Release
# Compiler flags:
# -m32 for 32bit, -m64 for 64bit
# -Wall turns on most, but not all, compiler warnings
#
CFLAGS := -m64 -Wall
DEBUGFLAGS = -O0 -g3 -DCAS_BACNET_STACK_LIB_TYPE_LIB
RELEASEFLAGS = -O3 -DCAS_BACNET_STACK_LIB_TYPE_LIB
OBJECTFLAGS = -c -fmessage-length=0 -fPIC -MMD -MP
LDFLAGS = -static
SOURCES = $(wildcard build/BACnetVirtualDevicesServerExampleCPP/*.cpp) $(wildcard submodules/cas-bacnet-stack/adapters/cpp/*.cpp) $(wildcard submodules/cas-bacnet-stack/submodules/cas-common/source/*.cpp)
OBJECTS = $(addprefix obj/,$(notdir $(SOURCES:.cpp=.o)))
INCLUDES = -IBACnetServerExample -Isubmodules/cas-bacnet-stack/adapters/cpp -Isubmodules/cas-bacnet-stack/source -Isubmodules/cas-bacnet-stack/submodules/cas-common/source
LIBPATH = -Lbin
LIB = -ldl -lCASBACnetStack_x64_Release
# Build Target
TARGET = $(NAME)
all: $(NAME)
$(NAME): $(OBJECTS)
@echo 'Building target: $@'
$(CC) $(CFLAGS) $(LDFLAGS) -o $(NAME) $(OBJECTS) $(LIBPATH) $(LIB)
@echo 'Finished building target: $@'
@echo ' '
obj/%.o: build/BACnetVirtualDevicesServerExampleCPP/%.cpp
@mkdir -p obj
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
$(CC) $(RELEASEFLAGS) $(CFLAGS) $(OBJECTFLAGS) $(INCLUDES) $(LIBPATH) -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o $@ $<
@echo 'Finished building: $<'
@echo ' '
obj/%.o: submodules/cas-bacnet-stack/adapters/cpp/%.cpp
@mkdir -p obj
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
$(CC) $(RELEASEFLAGS) $(CFLAGS) $(OBJECTFLAGS) $(INCLUDES) $(LIBPATH) -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o $@ $<
@echo 'Finished building: $<'
@echo ' '
obj/%.o: submodules/cas-bacnet-stack/submodules/cas-common/source/%.cpp
@mkdir -p obj
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
$(CC) $(RELEASEFLAGS) $(CFLAGS) $(OBJECTFLAGS) $(INCLUDES) $(LIBPATH) -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o $@ $<
@echo 'Finished building: $<'
@echo ' '
install:
install -D $(NAME) bin/$(NAME)
$(RM) $(NAME)
# make clean
# Removes target file and any .o object files,
# .d dependency files, or ~ backup files
clean:
$(RM) $(NAME) obj/* *~