[Skiboot] [PATCH v2 06/10] external/gard: Update gard building to use external/common files

Cyril Bur cyril.bur at au1.ibm.com
Wed Nov 11 15:40:00 AEDT 2015


This will enable building the gard tool on any arch which may prove useful
for debug parsing of gard records in a binary file format

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/gard/Makefile | 44 ++++++++++++++++++--------------------------
 external/gard/rules.mk | 26 ++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 26 deletions(-)
 create mode 100644 external/gard/rules.mk

diff --git a/external/gard/Makefile b/external/gard/Makefile
index 2c00dcc..c3dc6fb 100644
--- a/external/gard/Makefile
+++ b/external/gard/Makefile
@@ -1,41 +1,33 @@
 # This tool is a linux userland tool and should be completely stand alone
-
-prefix = /usr/local/
-sbindir = $(prefix)/sbin
-datadir = $(prefix)/share
-mandir = $(datadir)/man
-
-CC = $(CROSS_COMPILE)gcc
-CFLAGS += -m64 -Werror -Wall -g2 -ggdb
-LDFLAGS += -m64
-ASFLAGS = -m64
-CPPFLAGS += -I. -I../../
-
-OBJS = file.o gard.o libflash.o libffs.o ecc.o blocklevel.o
-
-EXE = gard
+include rules.mk
+GET_ARCH = ../../external/common/get_arch.sh
+include ../../external/common/rules.mk
 
 all: $(EXE)
 
-%.o: %.c
-	$(COMPILE.c) $< -o $@
+.PHONY: links
+links: libflash ccan common
+
+libflash:
+	ln -sf ../../libflash .
 
-%.o: ../../libflash/%.c
-	$(COMPILE.c) $< -o $@
+ccan:
+	ln -sf ../../ccan .
 
-$(EXE): $(OBJS)
-	$(LINK.o) -o $@ $^
+common:
+	ln -sf ../common .
 
 check: all
 	@ln -sf ../../test/test.sh test/test.sh
 	@test/test-gard
 
-install: all
-	install -D gard $(DESTDIR)$(sbindir)/opal-gard
-	install -D -m 0644 opal-gard.1 $(DESTDIR)$(mandir)/man1/opal-gard.1
+$(OBJS): | links arch_links
 
-clean:
-	rm -f $(OBJS) $(EXE) *.d test/test.sh
+clean: arch_clean
+	rm -f $(OBJS) $(EXE) *.o *.d
 
 distclean: clean
+	rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~ libflash/*.c~ libflash/*.h~
+	rm -f libflash ccan .version .version.tmp
+	rm -f common io.h make_version.sh
 
diff --git a/external/gard/rules.mk b/external/gard/rules.mk
new file mode 100644
index 0000000..bef8fbb
--- /dev/null
+++ b/external/gard/rules.mk
@@ -0,0 +1,26 @@
+.DEFAULT_GOAL := all
+
+override CFLAGS += -O2 -Wall -Werror -I.
+OBJS      = gard.o
+OBJS     += libflash/file.o libflash/libflash.o libflash/libffs.o libflash/ecc.o libflash/blocklevel.o
+OBJS     += common/arch_flash.o
+EXE       = gard
+
+CC = $(CROSS_COMPILE)gcc
+
+prefix = /usr/local/
+sbindir = $(prefix)/sbin
+datadir = $(prefix)/share
+mandir = $(datadir)/man
+
+%.o : %.c
+	$(CC) $(CFLAGS) -c $< -o $@
+
+$(EXE): $(OBJS)
+	$(CC) $(CFLAGS) $^ -o $@
+
+install: all
+	install -D gard $(DESTDIR)$(sbindir)/opal-gard
+	install -D -m 0644 opal-gard.1 $(DESTDIR)$(mandir)/man1/opal-gard.1
+
+
-- 
2.6.2



More information about the Skiboot mailing list