blob: 1c6a838f77bfc5f45e54588ab46cabd77386193d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# SPDX-License-Identifier: Apache-2.0
.DEFAULT_GOAL := all
override CFLAGS += -O2 -Wall -g -I.
EXE = ffspart
OBJS = $(EXE).o version.o
LIBFLASH_FILES := libflash.c libffs.c ecc.c blocklevel.c file.c
LIBFLASH_OBJS := $(addprefix libflash-, $(LIBFLASH_FILES:.c=.o))
LIBFLASH_SRC := $(addprefix libflash/,$(LIBFLASH_FILES))
OBJS += $(LIBFLASH_OBJS)
OBJS += common-arch_flash.o
CC = $(CROSS_COMPILE)gcc
FFSPART_VERSION ?= $(shell ./make_version.sh $(EXE))
version.c: make_version.sh .version
@(if [ "a$(FFSPART_VERSION)" = "a" ]; then \
echo "#error You need to set FFSPART_VERSION environment variable" > $@ ;\
else \
echo "const char version[] = \"$(FFSPART_VERSION)\";" ;\
fi) > $@
%.o : %.c
$(Q_CC)$(CC) $(CFLAGS) -c $< -o $@
$(LIBFLASH_SRC): | links
$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c
$(Q_CC)$(CC) $(CFLAGS) -c $< -o $@
$(EXE): $(OBJS)
$(Q_CC)$(CC) $(CFLAGS) $^ -lrt -o $@
|