-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
66 lines (53 loc) · 1.68 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
#
# This file is part of aircontrol.
#
# Copyright (C) 2014-2022 Ralf Dauberschmidt <[email protected]>
#
# aircontrol is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# aircontrol is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with aircontrol. If not, see <http://www.gnu.org/licenses/>.
#
APP=aircontrol
CC=g++
CFLAGS=-std=c++14 -Wall -Wno-unused-result -Iinclude
LDFLAGS=-lconfig++ -lwiringPi
BIN_DIR=bin
BUILD_DIR=build
ETC_DIR=etc
SRC_DIR=source
INSTALL_DIR=/usr/local/bin
SRC:=$(wildcard $(SRC_DIR)/*.cpp)
OBJ:=$(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(SRC:.cpp=.o))
DEPS:=$(OBJ:.o=.d)
$(BIN_DIR)/$(APP): pre-build scripts/version.sh $(OBJ)
@mkdir -p $(BIN_DIR)
$(CC) -o $@ $(OBJ) $(LDFLAGS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(BUILD_DIR)
$(CC) -c $(CFLAGS) -MMD -MP -MF $(patsubst %.o,%.d,$@) -o $@ $<
.PHONY: pre-build
pre-build:
@sh scripts/version.sh
install: $(BIN_DIR)/$(APP)
cp $(BIN_DIR)/$(APP) $(INSTALL_DIR)
cp -n $(ETC_DIR)/$(APP).conf /etc/
uninstall:
rm -f $(INSTALL_DIR)/$(APP)
cmp --silent $(ETC_DIR)/$(APP).conf /etc/$(APP).conf && rm -f /etc/$(APP).conf || true
.PHONY: doc
doc:
@cd doxygen; doxygen Doxyfile
.PHONY: clean
clean:
rm -rf $(BUILD_DIR) $(BIN_DIR)
rm -rf Doxygen/html Doxygen/*.db
-include $(DEPS)