diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1be6b8e --- /dev/null +++ b/Makefile @@ -0,0 +1,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 |