-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
167 lines (138 loc) · 4.5 KB
/
Copy pathMakefile
File metadata and controls
167 lines (138 loc) · 4.5 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Makefile for the OCADrone 'signal' IPC tool.
# Signal version : 2.0.0
# Makefile version: 4
#
# Author : Jean-Philippe Clipffel
# Creation date: 29/04/2014
# Last modified: 20/01/2015
#
# About signal IPC tool versions
# ------------------------------
# Format : Major.Medium.Minor
# Major : New versions, include new functionnalities
# Medium : Small API update, functionnalities enable / disabled
# Minor : Simple security patches and stability updates
#
# License GNU LGPL 2.1 and later
# ------------------------------
#
# Signal
# Copyright (C) 2015 Jean-Philippe Clipffel
# Email: jp.clipffel@gmail.com
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
# USA
# Variables
# =========
NAME_SERVER = sigserver
NAME_CLIENT = sigclient
PATH_ROOT = .
PATH_SOURCE = ./source
PATH_INCLUDE = ./include
INSTALL_PATH = /ocadrone/apps/signal
# Sources
# =======
SRC_SERVER = $(PATH_SOURCE)/main_server.cpp \
$(PATH_SOURCE)/server.cpp
SRC_CLIENT = $(PATH_SOURCE)/main_client.cpp
SRC_CFGFILE = $(PATH_ROOT)/sigserver.cfg
# Compilation options
# ===================
CC = g++
CFLAGS = -W -Wall -ansi -pedantic -O3 -std=c++11
CLIBS = -lKNM -lAISignal -lpthread
# Rules configuration
# ===================
.PHONY: help clean \
build build-server build-client \
install install-server install-client \
remove remove-server remove-client
.SILENT: help clean \
build build-server build-client \
install install-server install-client \
remove remove-server remove-client
# Basic Rules
# ===========
$(NAME): help
help:
@echo "Signal tools Makefile help"
@echo "--------------------------"
@echo ""
@echo "[*] Compilation"
@echo " Type 'make build' to build the tools."
@echo " To build only server: 'make build-server'"
@echo " To build only client: 'make build-client'"
@echo ""
@echo "[*] Installation"
@echo " Type 'make install' (as root)."
@echo ""
@echo "[*] Removing"
@echo " Type 'make remove'."
@echo ""
@echo "Note: The library 'libKNM' is needed."
# Compilation rules
# =================
build:
make --no-print-directory build-server
make --no-print-directory build-client
build-server:
@echo "Compiling signal server"
@echo "-----------------------"
@echo "Compiler : $(CC)"
@echo "Compiler flags : $(CFLAGS)"
@echo "Libraries : $(CLIBS)"
$(CC) $(CFLAGS) $(CLIBS) $(SRC_SERVER) -I $(PATH_INCLUDE) -o $(NAME_SERVER)
build-client:
@echo "Compiling signal client"
@echo "-----------------------"
@echo "Compiler : $(CC)"
@echo "Compiler flags : $(CFLAGS)"
@echo "Libraries : $(CLIBS)"
$(CC) $(CFLAGS) $(CLIBS) $(SRC_CLIENT) -I $(PATH_INCLUDE) -o $(NAME_CLIENT)
# Installation rules
# ==================
install:
if [ ! -d $(INSTALL_PATH) ]; then mkdir -p $(INSTALL_PATH); fi
make --no-print-directory install-server
make --no-print-directory install-client
install-server:
@echo "---"
@echo "Installing signal server"
@echo "Installation directory: $(INSTALL_PATH)"
cp $(NAME_SERVER) $(INSTALL_PATH)
if [ -e $(SRC_CFGFILE) ]; then cp $(SRC_CFGFILE) $(INSTALL_PATH); fi
@echo "Done."
install-client:
@echo "---"
@echo "Installing signal client"
@echo "Installation directory: $(INSTALL_PATH)"
cp $(NAME_CLIENT) $(INSTALL_PATH)
@echo "Done."
# Removing & cleaning rules
# =========================
remove:
make --no-print-directory remove-server
make --no-print-directory remove-client
remove-server:
@echo "Removing server"
rm $(INSTALL_PATH)/$(NAME_SERVER)
@echo "Done."
remove-client:
@echo "Removing client"
rm $(INSTALL_PATH)/$(NAME_CLIENT)
@echo "Done."
clean:
if [ -e $(NAME_SERVER) ]; then rm $(NAME_SERVER); fi
if [ -e $(NAME_CLIENT) ]; then rm $(NAME_CLIENT); fi