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.

96 lines
1.6 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 = main.c \
12 years ago
test_spiffs.c \
test_dev.c \
test_check.c \
12 years ago
test_hydrogen.c \
testsuites.c \
testrunner.c
include files.mk
INCLUDE_DIRECTIVES = -I./${sourcedir} -I./${sourcedir}/default -I./${sourcedir}/test
12 years ago
COMPILEROPTIONS = $(INCLUDE_DIRECTIVES)
############
#
# Tasks
#
############
vpath %.c ${sourcedir} ${sourcedir}/default ${sourcedir}/test
12 years ago
OBJFILES = $(CFILES:%.c=${builddir}/%.o)
12 years ago
DEPFILES = $(CFILES:%.c=${builddir}/%.d)
12 years ago
ALLOBJFILES += $(OBJFILES)
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} -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
test: all
./build/$(BINARY)
12 years ago
test_failed: all
./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