1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

added Makefile

git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@4 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
Steffen Vogel 2014-06-05 09:34:30 +00:00
parent d56732312d
commit a94694770b

61
Makefile Normal file
View file

@ -0,0 +1,61 @@
TARGETS = server test
OBJS = utils.o msg.o
SRCS = $(wildcard src/*.c)
DEPS = $(SRCS:src/%.c=dep/%.d)
SUBDIRS = doc
# Files
bin/server: OBJS += main.o node.o path.o
bin/test: OBJS += test.o
# Flags
INCS = -Iinclude/
DEFS = -D_XOPEN_SOURCE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L
LIBS = -lrt
CFLAGS = -g -std=c99 $(DEFS) $(INCS)
LDFLAGS = -pthread $(LIBS)
# Tools
RM = rm -f
CC = gcc -c
LD = gcc
DEP = gcc -MM
GDB = gdb -q
MKDIR = mkdir -p
# Pseudotargets
.SECONDARY:
.SECONDEXPANSION:
.PHONY: all clean realclean debug depend $(SUBDIRS)
all: $(addprefix bin/,$(TARGETS))
bin/%: $$(addprefix build/,$$(OBJS))
$(LD) $(LDFLAGS) $^ -o $@
build/%.o: src/%.c dep/%.d
$(CC) $(CFLAGS) $< -o $@
dep/%.d: src/%.c
$(DEP) $(CFLAGS) $< -o $@
debug: bin/server
$(GDB) -ex "break main" -ex "run $(ARGS)" bin/server
clean:
$(RM) build/* bin/*
realclean: clean
@for DIR in $(SUBDIRS); do $(MAKE) -C $$DIR clean; done
depend: $(DEPS)
$(SUBDIRS):
$(MAKE) -C $@
-include $(DEPS)