blob: 3af5d1a6a839b65672d0720ac14c690a1f87bf85 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
.DEFAULT_GOAL := all
override CFLAGS += -O2 -Wall -Werror -Wno-stringop-truncation -I.
OBJS = version.o gard.o units.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))
CCAN_FILES := list.c
CCAN_OBJS := $(addprefix ccan-list-, $(CCAN_FILES:.c=.o))
CCAN_SRC := $(addprefix ccan/list/,$(CCAN_FILES))
OBJS += $(LIBFLASH_OBJS) $(CCAN_OBJS)
OBJS += common-arch_flash.o
EXE = gard
prefix = /usr/local/
sbindir = $(prefix)/sbin
datadir = $(prefix)/share
mandir = $(datadir)/man
#This will only be unset if we're running out of git tree,
#../../make_version.sh is garanteed to exist that way
GARD_VERSION ?= $(shell ../../make_version.sh $(EXE))
version.c: .version
@(if [ "a$(GARD_VERSION)" = "a" ]; then \
echo "#error You need to set GARD_VERSION environment variable" > $@ ;\
else \
echo "const char version[] = \"$(GARD_VERSION)\";" ;\
fi) > $@
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(LIBFLASH_SRC): | links
$(CCAN_SRC): | links
$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(CCAN_OBJS): ccan-list-%.o: ccan/list/%.c
$(Q_CC)$(CC) $(CFLAGS) -c $< -o $@
$(EXE): $(OBJS)
$(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@
install: all
install -D gard $(DESTDIR)$(sbindir)/opal-gard
install -D -m 0644 opal-gard.1 $(DESTDIR)$(mandir)/man1/opal-gard.1
|