hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

Makefile (2989B)


      1 .POSIX:
      2 .SUFFIXES:
      3 include config.mk
      4 TESTCACHE = $(HARECACHE)/+test
      5 TESTHAREFLAGS = $(HAREFLAGS) -T
      6 STDLIB = .
      7 
      8 all:
      9 
     10 .SUFFIXES: .ha .ssa .s .o .scd .1
     11 .ssa.s:
     12 	@printf 'QBE\t%s\n' "$@"
     13 	@$(QBE) -o $@ $<
     14 
     15 .s.o:
     16 	@printf 'AS\t%s\n' "$@"
     17 	@$(AS) -g -o $@ $<
     18 
     19 .scd.1:
     20 	@printf 'SCDOC\t%s\n' "$@"
     21 	@$(SCDOC) < $< > $@
     22 
     23 include stdlib.mk
     24 
     25 hare_srcs = \
     26 	./cmd/hare/main.ha \
     27 	./cmd/hare/plan.ha \
     28 	./cmd/hare/progress.ha \
     29 	./cmd/hare/release.ha \
     30 	./cmd/hare/schedule.ha \
     31 	./cmd/hare/subcmds.ha \
     32 	./cmd/hare/target.ha
     33 
     34 harec_srcs = \
     35 	./cmd/harec/main.ha \
     36 	./cmd/harec/errors.ha
     37 
     38 haredoc_srcs = \
     39 	./cmd/haredoc/main.ha \
     40 	./cmd/haredoc/errors.ha \
     41 	./cmd/haredoc/env.ha \
     42 	./cmd/haredoc/hare.ha \
     43 	./cmd/haredoc/html.ha \
     44 	./cmd/haredoc/sort.ha \
     45 	./cmd/haredoc/resolver.ha
     46 
     47 include targets.mk
     48 
     49 $(HARECACHE)/hare.ssa: $(hare_srcs) $(stdlib_deps_any) $(stdlib_deps_$(PLATFORM)) scripts/version
     50 	@printf 'HAREC\t%s\n' "$@"
     51 	@HARECACHE=$(HARECACHE) $(HAREC) $(HAREFLAGS) \
     52 		$(HARE_DEFINES) -o $@ $(hare_srcs)
     53 
     54 $(TESTCACHE)/hare.ssa: $(hare_srcs) $(testlib_deps_any) $(testlib_deps_$(PLATFORM)) scripts/version
     55 	@printf 'HAREC\t%s\n' "$@"
     56 	@HARECACHE=$(TESTCACHE) $(HAREC) $(TESTHAREFLAGS) \
     57 		$(HARE_DEFINES) -o $@ $(hare_srcs)
     58 
     59 $(BINOUT)/hare: $(HARECACHE)/hare.o
     60 	@mkdir -p $(BINOUT)
     61 	@printf 'LD\t%s\n' "$@"
     62 	@$(LD) --gc-sections -T $(rtscript) -o $@ \
     63 		$(HARECACHE)/hare.o $(stdlib_deps_any) $(stdlib_deps_$(PLATFORM))
     64 
     65 $(BINOUT)/hare-tests: $(TESTCACHE)/hare.o
     66 	@mkdir -p $(BINOUT)
     67 	@printf 'LD\t%s\n' "$@"
     68 	@$(LD) -T $(rtscript) -o $@ \
     69 		$(TESTCACHE)/hare.o $(testlib_deps_any) $(testlib_deps_$(PLATFORM))
     70 
     71 $(BINOUT)/harec2: $(BINOUT)/hare $(harec_srcs)
     72 	@mkdir -p $(BINOUT)
     73 	@printf 'HARE\t%s\n' "$@"
     74 	@env HAREPATH=. HAREC=$(HAREC) QBE=$(QBE) $(BINOUT)/hare build \
     75 		$(HARE_DEFINES) -o $(BINOUT)/harec2 cmd/harec
     76 
     77 $(BINOUT)/haredoc: $(BINOUT)/hare $(haredoc_srcs)
     78 	@mkdir -p $(BINOUT)
     79 	@printf 'HARE\t%s\n' "$@"
     80 	@env HAREPATH=. HAREC=$(HAREC) QBE=$(QBE) $(BINOUT)/hare build \
     81 		$(HARE_DEFINES) -o $(BINOUT)/haredoc ./cmd/haredoc
     82 
     83 docs/html: $(BINOUT)/haredoc scripts/gen-docs
     84 	./scripts/gen-docs
     85 
     86 docs/hare.1: docs/hare.scd
     87 docs/haredoc.1: docs/haredoc.scd
     88 
     89 docs: docs/hare.1 docs/haredoc.1
     90 
     91 clean:
     92 	rm -rf $(HARECACHE) $(BINOUT) docs/hare.1 docs/haredoc.1 docs/html
     93 
     94 check: $(BINOUT)/hare-tests
     95 	@$(BINOUT)/hare-tests
     96 
     97 scripts/gen-docs: scripts/gen-stdlib
     98 scripts/gen-stdlib: scripts/gen-stdlib.sh
     99 
    100 all: $(BINOUT)/hare $(BINOUT)/harec2 $(BINOUT)/haredoc
    101 
    102 install: docs scripts/install-mods
    103 	mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 \
    104 		$(DESTDIR)$(SRCDIR)/hare/stdlib $(DESTDIR)$(LOCALSRCDIR)
    105 	install -m755 $(BINOUT)/hare $(DESTDIR)$(BINDIR)/hare
    106 	install -m755 $(BINOUT)/haredoc $(DESTDIR)$(BINDIR)/haredoc
    107 	install -m644 docs/hare.1 $(DESTDIR)$(MANDIR)/man1/hare.1
    108 	install -m644 docs/haredoc.1 $(DESTDIR)$(MANDIR)/man1/haredoc.1
    109 	./scripts/install-mods "$(DESTDIR)$(SRCDIR)/hare/stdlib"
    110 
    111 .PHONY: all clean check docs install $(BINOUT)/harec2 $(BINOUT)/haredoc