You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
2.1 KiB

12 years ago
BINARY = linux_spiffs_test
############
#
# Paths
#
############
sourcedir = src
builddir = build
#############
#
# Build tools
#
#############
CC = gcc $(COMPILEROPTIONS)
LD = ld
GDB = gdb
OBJCOPY = objcopy
OBJDUMP = objdump
MKDIR = mkdir -p
###############
#
# Files and libs
#
###############
CFILES_TEST = main.c \
12 years ago
test_spiffs.c \
test_dev.c \
test_check.c \
12 years ago
test_hydrogen.c \
test_bugreports.c \
12 years ago
testsuites.c \
testrunner.c
include files.mk
INCLUDE_DIRECTIVES = -I./${sourcedir} -I./${sourcedir}/default -I./${sourcedir}/test
COMPILEROPTIONS = $(INCLUDE_DIRECTIVES)
COMPILEROPTIONS_APP = \
-Wall -Wno-format-y2k -W -Wstrict-prototypes -Wmissing-prototypes \
-Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch \
-Wshadow -Wcast-align -Wchar-subscripts -Winline -Wnested-externs\
-Wredundant-decls
12 years ago
############
#
# Tasks
#
############
vpath %.c ${sourcedir} ${sourcedir}/default ${sourcedir}/test
12 years ago
OBJFILES = $(CFILES:%.c=${builddir}/%.o)
OBJFILES_TEST = $(CFILES_TEST:%.c=${builddir}/%.o)
12 years ago
DEPFILES = $(CFILES:%.c=${builddir}/%.d) $(CFILES_TEST:%.c=${builddir}/%.d)
12 years ago
ALLOBJFILES += $(OBJFILES) $(OBJFILES_TEST)
12 years ago
DEPENDENCIES = $(DEPFILES)
# link object files, create binary
12 years ago
$(BINARY): $(ALLOBJFILES)
@echo "... linking"
@${CC} $(LINKEROPTIONS) -o ${builddir}/$(BINARY) $(ALLOBJFILES) $(LIBS)
-include $(DEPENDENCIES)
# compile c files
$(OBJFILES) : ${builddir}/%.o:%.c
@echo "... compile $@"
@${CC} $(COMPILEROPTIONS_APP) -g -c -o $@ $<
$(OBJFILES_TEST) : ${builddir}/%.o:%.c
12 years ago
@echo "... compile $@"
@${CC} -g -c -o $@ $<
# make dependencies
$(DEPFILES) : ${builddir}/%.d:%.c
@echo "... depend $@"; \
rm -f $@; \
${CC} $(COMPILEROPTIONS) -M $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*, ${builddir}/\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
all: mkdirs $(BINARY)
12 years ago
mkdirs:
-@${MKDIR} ${builddir}
-@${MKDIR} test_data
FILTER ?=
test: $(BINARY)
ifdef $(FILTER)
./build/$(BINARY)
else
./build/$(BINARY) -f $(FILTER)
endif
test_failed: $(BINARY)
./build/$(BINARY) _tests_fail
12 years ago
clean:
@echo ... removing build files in ${builddir}
@rm -f ${builddir}/*.o
@rm -f ${builddir}/*.d
@rm -f ${builddir}/*.elf