Andrew Jeffery | c7a446e | 2022-07-21 10:14:54 +0930 | [diff] [blame^] | 1 | all: ipkdbg |
| 2 | |
| 3 | ARCH_PPC64LE_BINS= |
| 4 | ARCH_X86_64_BINS= |
| 5 | |
| 6 | SOURCE_DATE_EPOCH=$(shell git log --format='%at' -n1 -- `git ls-files bin`) |
| 7 | |
| 8 | STRIPPED_ARCH_PPC64LE_BINS=$(patsubst %,stripped/%,$(ARCH_PPC64LE_BINS)) |
| 9 | STRIPPED_ARCH_X86_64_BINS=$(patsubst %,stripped/%,$(ARCH_X86_64_BINS)) |
| 10 | |
| 11 | STRIPPED_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 |
| 24 | bin.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 | |
| 34 | bin.tar.gz.b64: bin.tar.gz |
| 35 | base64 $^ > $@ |
| 36 | |
| 37 | ipkdbg: ipkdbg.in bin.tar.gz.b64 |
| 38 | cat $^ > $@ |
| 39 | chmod +x $@ |
| 40 | |
| 41 | .PHONY: clean |
| 42 | clean: |
| 43 | $(RM) -r stripped |
| 44 | $(RM) bin.tar.gz bin.tar.gz.b64 ipkdbg |