forked from labnation/DeviceInterface.CXX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (57 loc) · 1.3 KB
/
Makefile
File metadata and controls
73 lines (57 loc) · 1.3 KB
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
# Directories
PREFIX ?= /usr
OUT_DIR := build
SRC_DIR := src
LIB_DIR := $(PREFIX)/lib
LIB_DIR_PARAM :=$(foreach d, $(LIB_DIR), -L$d)
INCLUDE_DIR := include
ifndef CFLAGS
INCLUDE_DIR += $(PREFIX)/include
endif
INCLUDE_DIR_PARAM :=$(foreach d, $(INCLUDE_DIR), -I$d)
SRCS := \
main.cpp \
hardware/smartscopeusb.cpp \
net/interfaceserver.cpp \
utils.cpp
ifdef LEDE
SRCS := $(SRCS)\
lede.cpp
CFLAGS += -DLEDE
endif
OBJS := $(SRCS:.cpp=.cpp.o)
OBJS := $(addprefix $(OUT_DIR)/,$(OBJS))
DEPS := $(OBJS:.o=.d)
CC = $(CROSS_COMPILE)c++
LD = $(CROSS_COMPILE)ld
CFLAGS += -Wall -g $(INCLUDE_DIR_PARAM) -MMD -MP -std=c++11
LIBS := -lusb-1.0 -lpthread -lstdc++
ifdef DNSSD
CFLAGS += -DDNSSD
else
LIBS += -lavahi-client -lavahi-common -ldbus-1
endif
LDFLAGS += -Wall $(LIBS) $(LIB_DIR_PARAM)
ifdef DEBUG
CFLAGS += -DDEBUG -g
else
CFLAGS += -O3
endif
ifdef BUILD_VERSION
CFLAGS += -DBUILD_VERSION="\"$(BUILD_VERSION)\""
endif
.PHONY: all clean clear install
all: smartscopeserver
clean:
-rm -rf $(OUT_DIR)
install: all
install -m 755 -d $(DESTDIR)/usr/bin
install -m 755 smartscopeserver $(DESTDIR)/usr/bin
-include $(DEPS)
smartscopeserver: $(OBJS)
@printf " Making %s %s\n" $@ $^
$(CC) -o $@ $^ $(LDFLAGS)
$(OUT_DIR)/%.cpp.o: $(SRC_DIR)/%.cpp
@printf " CC %s\n" $@
@mkdir -p $(@D)
$(CC) $(CFLAGS) -o $@ -c $<