hare

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

commit 0bfb86446fe627a941716c1e0f169ed2c69f5ca7
parent 7bada30df0f32f5bdf2b9ba9900b92c22d1eaf2e
Author: Lorenz (xha) <me@xha.li>
Date:   Sat, 25 Nov 2023 15:18:02 +0100

remove config.example.mk and add configs/<platform>.mk

Signed-off-by: Lorenz (xha) <me@xha.li>

Diffstat:
M.builds/alpine.yml | 2+-
M.builds/freebsd.yml | 2+-
MMakefile | 4++--
Dconfig.example.mk | 42------------------------------------------
Aconfigs/freebsd.mk | 42++++++++++++++++++++++++++++++++++++++++++
Aconfigs/linux.mk | 42++++++++++++++++++++++++++++++++++++++++++
Aconfigs/openbsd.mk | 43+++++++++++++++++++++++++++++++++++++++++++
7 files changed, 131 insertions(+), 46 deletions(-)

diff --git a/.builds/alpine.yml b/.builds/alpine.yml @@ -29,7 +29,7 @@ tasks: sudo make install - hare: | cd hare - cp config.example.mk config.mk + cp configs/linux.mk config.mk make -j2 sudo make install - check: | diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml @@ -19,7 +19,7 @@ tasks: sudo make install - hare: | cd hare - sed -e 's/linux/freebsd/g' < config.example.mk > config.mk + cp configs/freebsd.mk config.mk make -j2 sudo make install - check: | diff --git a/Makefile b/Makefile @@ -42,14 +42,14 @@ HARE_DEFINES = \ $(BINOUT)/hare: $(OBJS) @mkdir -p -- "$(BINOUT)" @printf 'LD\t%s\n' "$@" - @$(LD) $(LDLINKFLAGS) --gc-sections -z noexecstack -T $(RTSCRIPT) -o $@ $(OBJS) + @$(LD) $(LDLINKFLAGS) -T $(RTSCRIPT) -o $@ $(OBJS) $(BINOUT)/harec2: $(BINOUT)/hare @printf 'HARE\t%s\n' "$@" @env HAREPATH=. HAREC=$(HAREC) QBE=$(QBE) AS=$(AS) LD=$(LD) \ HAREFLAGS=$(HAREFLAGS) HARECFLAGS=$(HARECFLAGS) \ QBEFLAGS=$(QBEFLAGS) ASFLAGS=$(ASFLAGS) \ - LDLINKFLAGS=$(LDLINKFLAGS) \ + LDLINKFLAGS="$(LDLINKFLAGS)" \ $(BINOUT)/hare build $(HARE_DEFINES) -o $(BINOUT)/harec2 cmd/harec $(BINOUT)/haredoc: $(BINOUT)/hare diff --git a/config.example.mk b/config.example.mk @@ -1,42 +0,0 @@ -# install locations -PREFIX = /usr/local -BINDIR = $(PREFIX)/bin -MANDIR = $(PREFIX)/share/man -SRCDIR = $(PREFIX)/src -STDLIB = $(SRCDIR)/hare/stdlib - -# variables used during build -PLATFORM = linux -ARCH = x86_64 -HAREFLAGS = -HARECFLAGS = -QBEFLAGS = -ASFLAGS = -LDLINKFLAGS = - -# commands used by the build script -HAREC = harec -QBE = qbe -AS = as -LD = ld -SCDOC = scdoc - -# build locations -HARECACHE = .cache -BINOUT = .bin - -# variables that will be embedded in the binary with -D definitions -HAREPATH = $(SRCDIR)/hare/stdlib:$(SRCDIR)/hare/third-party -VERSION=$$(./scripts/version) - -AARCH64_AS=aarch64-as -AARCH64_CC=aarch64-cc -AARCH64_LD=aarch64-ld - -RISCV64_AS=riscv64-as -RISCV64_CC=riscv64-cc -RISCV64_LD=riscv64-ld - -X86_64_AS=as -X86_64_CC=cc -X86_64_LD=ld diff --git a/configs/freebsd.mk b/configs/freebsd.mk @@ -0,0 +1,42 @@ +# install locations +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man +SRCDIR = $(PREFIX)/src +STDLIB = $(SRCDIR)/hare/stdlib + +# variables used during build +PLATFORM = freebsd +ARCH = x86_64 +HAREFLAGS = +HARECFLAGS = +QBEFLAGS = +ASFLAGS = +LDLINKFLAGS = --gc-sections -z noexecstack + +# commands used by the build script +HAREC = harec +QBE = qbe +AS = as +LD = ld +SCDOC = scdoc + +# build locations +HARECACHE = .cache +BINOUT = .bin + +# variables that will be embedded in the binary with -D definitions +HAREPATH = $(SRCDIR)/hare/stdlib:$(SRCDIR)/hare/third-party +VERSION=$$(./scripts/version) + +AARCH64_AS=aarch64-as +AARCH64_CC=aarch64-cc +AARCH64_LD=aarch64-ld + +RISCV64_AS=riscv64-as +RISCV64_CC=riscv64-cc +RISCV64_LD=riscv64-ld + +X86_64_AS=as +X86_64_CC=cc +X86_64_LD=ld diff --git a/configs/linux.mk b/configs/linux.mk @@ -0,0 +1,42 @@ +# install locations +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man +SRCDIR = $(PREFIX)/src +STDLIB = $(SRCDIR)/hare/stdlib + +# variables used during build +PLATFORM = linux +ARCH = x86_64 +HAREFLAGS = +HARECFLAGS = +QBEFLAGS = +ASFLAGS = +LDLINKFLAGS = --gc-sections -z noexecstack + +# commands used by the build script +HAREC = harec +QBE = qbe +AS = as +LD = ld +SCDOC = scdoc + +# build locations +HARECACHE = .cache +BINOUT = .bin + +# variables that will be embedded in the binary with -D definitions +HAREPATH = $(SRCDIR)/hare/stdlib:$(SRCDIR)/hare/third-party +VERSION=$$(./scripts/version) + +AARCH64_AS=aarch64-as +AARCH64_CC=aarch64-cc +AARCH64_LD=aarch64-ld + +RISCV64_AS=riscv64-as +RISCV64_CC=riscv64-cc +RISCV64_LD=riscv64-ld + +X86_64_AS=as +X86_64_CC=cc +X86_64_LD=ld diff --git a/configs/openbsd.mk b/configs/openbsd.mk @@ -0,0 +1,43 @@ +# install locations +PREFIX = /home/lorenz/bin +BINDIR = $(PREFIX)/bin +MANDIR = $(PREFIX)/share/man +SRCDIR = $(PREFIX)/src +STDLIB = $(SRCDIR)/hare/stdlib + +# variables used during build +PLATFORM = openbsd +ARCH = x86_64 +HAREFLAGS = +HARECFLAGS = +QBEFLAGS = +ASFLAGS = +LDLINKFLAGS = -z nobtcfi + +# commands used by the build script +HAREC = harec +QBE = qbe +# OpenBSD: gas is in the binutils package. as from the base system is too old. +AS = gas +LD = cc +SCDOC = scdoc + +# build locations +HARECACHE = .cache +BINOUT = .bin + +# variables that will be embedded in the binary with -D definitions +HAREPATH = $(SRCDIR)/hare/stdlib:$(SRCDIR)/hare/third-party +VERSION=$$(./scripts/version) + +AARCH64_AS=aarch64-gas +AARCH64_CC=aarch64-cc +AARCH64_LD=aarch64-cc + +RISCV64_AS=riscv64-gas +RISCV64_CC=riscv64-cc +RISCV64_LD=riscv64-cc + +X86_64_AS=gas +X86_64_CC=cc +X86_64_LD=cc