1
# Compiler and default flags
6
# Defaults for directories
7
ROOTDIR ?= $(shell pwd)
13
DEPENDDIR ?= $(ROOTDIR)
15
CXXFLAGS += $(addprefix -I ,$(INCDIR)) -fPIC
16
CFLAGS += $(addprefix -I ,$(INCDIR)) -fPIC -std=c99
18
# Source files in this directory
19
SRC = $(wildcard *.cpp)
20
SRCC = $(wildcard *.c)
22
SRC += $(wildcard ipecamera/*.cpp)
23
SRCC += $(wildcard ipecamera/*.c)
25
SRC += $(wildcard dma/*.cpp)
26
SRCC += $(wildcard dma/*.c)
28
# Corresponding object files
29
OBJ = $(addprefix $(OBJDIR)/,$(SRC:.cpp=.o))
30
OBJ += $(addprefix $(OBJDIR)/,$(SRCC:.c=.o))
32
# Corresponding dependency files
33
DEPEND = $(addprefix $(DEPENDDIR)/,$(SRC:.cpp=.d))
34
DEPEND += $(addprefix $(DEPENDDIR)/,$(SRCC:.c=.d))
36
# This makes Verbose easier. Just prefix $(Q) to any command
43
###############################################################
46
# Target for automatic dependency generation
47
depend: $(DEPEND) $(DEPENDC);
49
# This rule generates a dependency makefile for each source
51
@echo -e "DEPEND \t$<"
52
$(Q)$(CC) $(addprefix -I ,$(INCDIR)) -MM -MF $@ \
53
-MT $(OBJDIR)/$(<:.c=.o) -MT $@ $<
55
# This includes the automatically
56
# generated dependency files
61
$(Q)@$(CC) $(CFLAGS) -c -o $@ $<