xref: /openbmc/openbmc-tools/ipkdbg/Makefile (revision c7a446e2)
1all: ipkdbg
2
3ARCH_PPC64LE_BINS=
4ARCH_X86_64_BINS=
5
6SOURCE_DATE_EPOCH=$(shell git log --format='%at' -n1 -- `git ls-files bin`)
7
8STRIPPED_ARCH_PPC64LE_BINS=$(patsubst %,stripped/%,$(ARCH_PPC64LE_BINS))
9STRIPPED_ARCH_X86_64_BINS=$(patsubst %,stripped/%,$(ARCH_X86_64_BINS))
10
11STRIPPED_BINS=$(STRIPPED_ARCH_PPC64LE_BINS) \
12	      $(STRIPPED_ARCH_X86_64_BINS)
13
14$(STRIPPED_ARCH_PPC64LE_BINS): stripped/%: %
15	mkdir -p $(dir $@) && \
16	powerpc64le-linux-gnu-strip --strip-all -o $@ $<
17
18$(STRIPPED_ARCH_X86_64_BINS): stripped/%: %
19	mkdir -p $(dir $@) && \
20	x86_64-linux-gnu-strip --strip-all -o $@ $<
21
22# https://reproducible-builds.org/docs/archives/
23# https://www.gnu.org/software/tar/manual/html_section/create-options.html
24bin.tar.gz: $(STRIPPED_BINS)
25	tar \
26		--sort=name \
27		--clamp-mtime \
28		--mtime="@${SOURCE_DATE_EPOCH}" \
29		--owner=0 --group=0 --numeric-owner \
30		--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
31		-czf $@ \
32		-C stripped $(patsubst stripped/%,%,$^)
33
34bin.tar.gz.b64: bin.tar.gz
35	base64 $^ > $@
36
37ipkdbg: ipkdbg.in bin.tar.gz.b64
38	cat $^ > $@
39	chmod +x $@
40
41.PHONY: clean
42clean:
43	$(RM) -r stripped
44	$(RM) bin.tar.gz bin.tar.gz.b64 ipkdbg
45