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
|
## Copyright (C) 2014-2016
## Olivier Gayot <ogayot@baylibre.com>
## Bartosz Golaszewski <bgolaszewski@baylibre.com>
## Olivier Gayot <olivier.gayot@sigexec.com>
##
## This program 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 2 of the License, or
## (at your option) any later version.
##
## This program 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 this program; if not, write to the Free Software Foundation, Inc.,
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
CC = $(CROSS_COMPILE)gcc
USERFLAGS =
CFLAGS += -I./include -I/usr/local/include -W -Wall -Wextra
CFLAGS += -D_GNU_SOURCE $(USERFLAGS)
LDFLAGS += -L./lib -L/usr/local/lib -lwebsockets -lconfig $(USERFLAGS)
PROGNAME = caod
OBJS = daemon.o log.o misc.o
ifdef DEBUG
CFLAGS += -g$(DEBUG) -D CONFIG_DEBUG -O0
else
CFLAGS += -O2
endif
all: $(PROGNAME)
$(PROGNAME): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS)
clean:
$(RM) $(OBJS)
$(RM) $(PROGNAME)
mrproper: clean
help:
@echo "CAO daemon Makefile targets:"
@echo
@echo "Build:"
@echo " all\t\t- build all cao objects, libraries and executables,"
@echo
@echo "Cleaning:"
@echo " clean\t\t- remove caod objects and executables,"
@echo " libclean\t- remove external library build files,"
@echo " mrproper\t- clean everything,"
@echo
@echo "Makefile variables:"
@echo " CROSS_COMPILE\t- cross-toolchain prefix,"
@echo " ARCH\t\t- build architecture,"
@echo " DEBUG\t\t- compile additional debug messages and pass the -g"
@echo " \t\t flag to gcc, you can also specify a level for said flag,"
@echo
.PHONY: all clean mrproper help
.PRECIOUS: %.c
.SUFFIXES:
.SUFFIXES: .o .c
.DEFAULT_GOAL :=
.DEFAULT_GOAL := all
.c.o:
$(CC) -c -o $*.o $(CFLAGS) $(DEBUGFLAGS) $*.c
|