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.
 
 
 

95 lines
1.6 KiB

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 = main.c \
test_spiffs.c \
test_dev.c \
test_check.c \
test_hydrogen.c \
testsuites.c \
testrunner.c
include files.mk
INCLUDE_DIRECTIVES = -I./${sourcedir} -I./${sourcedir}/default -I./${sourcedir}/test
COMPILEROPTIONS = $(INCLUDE_DIRECTIVES)
############
#
# Tasks
#
############
vpath %.c ${sourcedir} ${sourcedir}/default ${sourcedir}/test
OBJFILES = $(CFILES:%.c=${builddir}/%.o)
DEPFILES = $(CFILES:%.c=${builddir}/%.d)
ALLOBJFILES += $(OBJFILES)
DEPENDENCIES = $(DEPFILES)
# link object files, create binary
$(BINARY): $(ALLOBJFILES)
@echo "... linking"
@${CC} $(LINKEROPTIONS) -o ${builddir}/$(BINARY) $(ALLOBJFILES) $(LIBS)
-include $(DEPENDENCIES)
# compile c files
$(OBJFILES) : ${builddir}/%.o:%.c
@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)
mkdirs:
-@${MKDIR} ${builddir}
-@${MKDIR} test_data
test: all
./build/$(BINARY)
test_failed: all
./build/$(BINARY) _tests_fail
clean:
@echo ... removing build files in ${builddir}
@rm -f ${builddir}/*.o
@rm -f ${builddir}/*.d
@rm -f ${builddir}/*.elf