blob: fb9402f8fa2f4895badb9f3d91e2e7018cd50676 (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# SPDX-License-Identifier: Apache-2.0
CFLAGS += -m64 -Werror -Wall -g2 -ggdb
LDFLAGS += -m64
ASFLAGS = -m64
CPPFLAGS += -I. -I../../include -I../../
prefix = /usr/local/
sbindir = $(prefix)/sbin
datadir = $(prefix)/share
mandir = $(datadir)/man
all: links arch_links | opal-prd
GET_ARCH = ../../external/common/get_arch.sh
include ../../external/common/rules.mk
LIBFLASH_OBJS = libflash-blocklevel.o libflash-libffs.o \
libflash-libflash.o libflash-ecc.o \
libflash-file.o
OBJS = opal-prd.o thunk.o pnor.o i2c.o module.o version.o \
$(LIBFLASH_OBJS) common-arch_flash.o
OPAL_PRD_VERSION ?= $(shell ../../make_version.sh opal-prd)
ifdef KERNEL_DIR
links += asm/opal-prd.h
endif
asm/opal-prd.h:
$(Q_MKDIR)mkdir -p asm
$(Q_LN)ln -sfr $(KERNEL_DIR)/arch/powerpc/include/uapi/asm/opal-prd.h \
asm/opal-prd.h
%.o: %.c
$(Q_CC)$(COMPILE.c) $< -o $@
$(LIBFLASH_OBJS): libflash-%.o : libflash/%.c
$(Q_CC)$(COMPILE.c) $< -o $@
%.o: %.S
$(Q_CC)$(COMPILE.S) $< -o $@
opal-prd: $(OBJS)
$(Q_LINK)$(LINK.o) -o $@ $^
version.c: ../../make_version.sh .version
@(if [ "a$(OPAL_PRD_VERSION)" = "a" ]; then \
echo "#error You need to set OPAL_PRD_VERSION environment variable" > $@ ;\
else \
echo "const char version[] = \"$(OPAL_PRD_VERSION)\";" ;\
fi) > $@
.PHONY: VERSION-always
.version: VERSION-always
@echo $(OPAL_PRD_VERSION) > $@.tmp
@cmp -s $@ $@.tmp || cp $@.tmp $@
@rm -f $@.tmp
test: links test/test_pnor
test/test_pnor: test/test_pnor.o pnor.o $(LIBFLASH_OBJS) common-arch_flash.o
$(Q_LINK)$(LINK.o) -o $@ $^
install: all
install -D opal-prd $(DESTDIR)$(sbindir)/opal-prd
install -D -m 0644 opal-prd.8 $(DESTDIR)$(mandir)/man8/opal-prd.8
clean:
$(RM) *.[odsa] opal-prd
$(RM) test/*.[odsa] test/test_pnor
distclean: clean
$(RM) -f $(LINKS) asm
$(RM) -f libflash ccan version.c .version common
|