|
| 1 | +#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ |
| 2 | +#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ |
| 3 | + |
| 4 | +SHELL = /bin/sh |
| 5 | +MAKEFLAGS += --no-builtin-rules |
| 6 | + |
| 7 | +.SUFFIXES: |
| 8 | +.DELETE_ON_ERROR: |
| 9 | +.FEATURES: output-sync |
| 10 | +.PHONY: o clean |
| 11 | + |
| 12 | +o: o/$(MODE)/blink |
| 13 | +test: o/$(MODE)/test |
| 14 | +clean:; rm -rf o |
| 15 | +tags: TAGS HTAGS |
| 16 | + |
| 17 | +include build/config.mk |
| 18 | +include build/rules.mk |
| 19 | +include blink/blink.mk |
| 20 | +include test/test.mk |
| 21 | +include test/blink/test.mk |
| 22 | +include third_party/gcc/gcc.mk |
| 23 | +include third_party/qemu/qemu.mk |
| 24 | + |
| 25 | +OBJS = $(foreach x,$(PKGS),$($(x)_OBJS)) |
| 26 | +SRCS := $(foreach x,$(PKGS),$($(x)_SRCS)) |
| 27 | +HDRS := $(foreach x,$(PKGS),$($(x)_HDRS)) |
| 28 | +INCS = $(foreach x,$(PKGS),$($(x)_INCS)) |
| 29 | +BINS = $(foreach x,$(PKGS),$($(x)_BINS)) |
| 30 | +TESTS = $(foreach x,$(PKGS),$($(x)_TESTS)) |
| 31 | +CHECKS = $(foreach x,$(PKGS),$($(x)_CHECKS)) |
| 32 | + |
| 33 | +o/$(MODE)/.x: |
| 34 | + mkdir -p $(@D) |
| 35 | + touch $@ |
| 36 | +o/$(MODE)/srcs.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(SRCS),$(dir $(x)))) |
| 37 | + $(file >$@) $(foreach x,$(SRCS),$(file >>$@,$(x))) |
| 38 | +o/$(MODE)/hdrs.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(HDRS) $(INCS),$(dir $(x)))) |
| 39 | + $(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x))) |
| 40 | + |
| 41 | +DEPENDS = \ |
| 42 | + o/$(MODE)/depend.host \ |
| 43 | + o/$(MODE)/depend.i486 \ |
| 44 | + o/$(MODE)/depend.m68k \ |
| 45 | + o/$(MODE)/depend.x86_64 \ |
| 46 | + o/$(MODE)/depend.arm \ |
| 47 | + o/$(MODE)/depend.aarch64 \ |
| 48 | + o/$(MODE)/depend.riscv64 \ |
| 49 | + o/$(MODE)/depend.mips \ |
| 50 | + o/$(MODE)/depend.mipsel \ |
| 51 | + o/$(MODE)/depend.mips64 \ |
| 52 | + o/$(MODE)/depend.mips64el \ |
| 53 | + o/$(MODE)/depend.s390x \ |
| 54 | + o/$(MODE)/depend.microblaze \ |
| 55 | + o/$(MODE)/depend.powerpc \ |
| 56 | + o/$(MODE)/depend.powerpc64le |
| 57 | + |
| 58 | +o/$(MODE)/depend: $(DEPENDS) |
| 59 | + cat $^ >$@ |
| 60 | +o/$(MODE)/depend.host: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 61 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 62 | +o/$(MODE)/depend.i486: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 63 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/i486/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 64 | +o/$(MODE)/depend.m68k: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 65 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/m68k/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 66 | +o/$(MODE)/depend.x86_64: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 67 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/x86_64/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 68 | +o/$(MODE)/depend.x86_64-gcc48: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 69 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/x86_64-gcc48/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 70 | +o/$(MODE)/depend.arm: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 71 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/arm/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 72 | +o/$(MODE)/depend.aarch64: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 73 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/aarch64/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 74 | +o/$(MODE)/depend.riscv64: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 75 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/riscv64/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 76 | +o/$(MODE)/depend.mips: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 77 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/mips/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 78 | +o/$(MODE)/depend.mipsel: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 79 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/mipsel/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 80 | +o/$(MODE)/depend.mips64: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 81 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/mips64/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 82 | +o/$(MODE)/depend.mips64el: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 83 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/mips64el/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 84 | +o/$(MODE)/depend.s390x: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 85 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/s390x/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 86 | +o/$(MODE)/depend.microblaze: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 87 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/microblaze/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 88 | +o/$(MODE)/depend.powerpc: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 89 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/powerpc/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 90 | +o/$(MODE)/depend.powerpc64le: build/bootstrap/mkdeps.com o/$(MODE)/srcs.txt o/$(MODE)/hdrs.txt |
| 91 | + build/bootstrap/mkdeps.com -o $@ -r o/$(MODE)/powerpc64le/ @o/$(MODE)/srcs.txt @o/$(MODE)/hdrs.txt |
| 92 | + |
| 93 | +TAGS: o/$(MODE)/srcs.txt $(SRCS) |
| 94 | + $(RM) $@ |
| 95 | + $(TAGS) $(TAGSFLAGS) -L $< -o $@ |
| 96 | + |
| 97 | +HTAGS: o/$(MODE)/hdrs.txt $(HDRS) |
| 98 | + $(RM) $@ |
| 99 | + build/htags -L $< -o $@ |
| 100 | + |
| 101 | +$(SRCS): |
| 102 | +$(HDRS): |
| 103 | +$(INCS): |
| 104 | +.DEFAULT: |
| 105 | + @echo >&2 |
| 106 | + @echo NOTE: deleting o/$(MODE)/depend because of an unspecified prerequisite: $@ >&2 |
| 107 | + @echo >&2 |
| 108 | + rm -f o/$(MODE)/depend $(DEPENDS) |
| 109 | + |
| 110 | +-include o/$(MODE)/depend |
0 commit comments