Skip to content

Commit

Permalink
Use implicit rules in bounties Makefile (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli authored Oct 16, 2024
1 parent e935a07 commit 7bc7894
Showing 1 changed file with 52 additions and 56 deletions.
108 changes: 52 additions & 56 deletions tests/bounties/Makefile
Original file line number Diff line number Diff line change
@@ -1,81 +1,77 @@
ALIAS_TEMPLATE=shopt -s expand_aliases\nalias %s='%s-%s'\n
ALIAS_TEMPLATE= shopt -s expand_aliases\nalias %s='%s-%s'\n
TAR_OPTS= --transform='s,/*[^/]*/[^/]*/,,' --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime -cJf

.PHONY: all
all:

all: dist/lua-5.4.3-bounty.tar.xz

dist/lua-5.4.3-bounty.tar.xz: build/lua/5.4.3/aliases.sh src/lua/start.sh src/lua/bounty.lua | dist
tar -cJf $@ -C build/lua/5.4.3 aliases.sh -C ../../../src/lua start.sh bounty.lua

build/lua/5.4.3/aliases.sh: | build/lua/5.4.3
printf "$(ALIAS_TEMPLATE)" lua lua 5.4.3 > $@

build/lua/5.4.3:
mkdir -p $@

all: dist/lua-5.4.7-bounty.tar.xz

dist/lua-5.4.7-bounty.tar.xz: build/lua/5.4.7/aliases.sh src/lua/start.sh src/lua/bounty.lua | dist
tar -cJf $@ -C build/lua/5.4.7 aliases.sh -C ../../../src/lua start.sh bounty.lua
.PHONY: clean
clean:
rm -rf build

build/lua/5.4.7/aliases.sh: | build/lua/5.4.7
printf "$(ALIAS_TEMPLATE)" lua lua 5.4.7 > $@
.PHONY: distclean
distclean: clean
rm -rf dist

build/lua/5.4.7:
mkdir -p $@
###################
# Lua
###################

all: dist/sqlite-3.32.2-bounty.tar.xz
LUA_VERSIONS= 5.4.3 5.4.7

dist/sqlite-3.32.2-bounty.tar.xz: build/sqlite/3.32.2/aliases.sh src/sqlite/start.sh | dist
tar -cJf $@ -C build/sqlite/3.32.2 aliases.sh -C ../../../src/sqlite start.sh
all: $(patsubst %,dist/lua-%-bounty.tar.xz,$(LUA_VERSIONS))

build/sqlite/3.32.2/aliases.sh: | build/sqlite/3.32.2
printf "$(ALIAS_TEMPLATE)" sqlite3 sqlite 3.32.2 > $@
dist/lua-%-bounty.tar.xz: build/lua-%-bounty/aliases.sh src/lua/start.sh src/lua/bounty.lua
mkdir -p $(@D)
tar $(TAR_OPTS) $@ $^

build/sqlite/3.32.2:
mkdir -p $@
build/lua-%-bounty/aliases.sh:
mkdir -p $(@D)
printf "$(ALIAS_TEMPLATE)" lua lua $* > $@

all: dist/sqlite-3.43.2-bounty.tar.xz
###################
# SQLite
###################

dist/sqlite-3.43.2-bounty.tar.xz: build/sqlite/3.43.2/aliases.sh src/sqlite/start.sh | dist
tar -cJf $@ -C build/sqlite/3.43.2 aliases.sh -C ../../../src/sqlite start.sh
SQLITE_VERSIONS= 3.32.2 3.43.2

build/sqlite/3.43.2/aliases.sh: | build/sqlite/3.43.2
printf "$(ALIAS_TEMPLATE)" sqlite3 sqlite 3.43.2 > $@
all: $(patsubst %,dist/sqlite-%-bounty.tar.xz,$(SQLITE_VERSIONS))

build/sqlite/3.43.2:
mkdir -p $@
dist/sqlite-%-bounty.tar.xz: build/sqlite-%-bounty/aliases.sh src/sqlite/start.sh
mkdir -p $(@D)
tar $(TAR_OPTS) $@ $^

all: dist/busybox-1.36.1-bounty.tar.xz
build/sqlite-%-bounty/aliases.sh:
mkdir -p $(@D)
printf "$(ALIAS_TEMPLATE)" sqlite3 sqlite $* > $@

dist/busybox-1.36.1-bounty.tar.xz: build/busybox/1.36.1/aliases.sh src/busybox/start.sh | dist
tar -cJf $@ -C build/busybox/1.36.1 aliases.sh -C ../../../src/busybox start.sh
###################
# BusyBox
###################

build/busybox/1.36.1/aliases.sh: | build/busybox/1.36.1
printf "$(ALIAS_TEMPLATE)" busybox busybox 1.36.1 > $@
BUSYBOX_VERSIONS= 1.36.1

build/busybox/1.36.1:
mkdir -p $@
all: $(patsubst %,dist/busybox-%-bounty.tar.xz,$(BUSYBOX_VERSIONS))

all: dist/solc-0.8.27-bounty.tar.xz
dist/busybox-%-bounty.tar.xz: build/busybox-%-bounty/aliases.sh src/busybox/start.sh
mkdir -p $(@D)
tar $(TAR_OPTS) $@ $^

dist/solc-0.8.27-bounty.tar.xz: build/solc/0.8.27/aliases.sh src/solc/start.sh | dist
tar -cJf $@ -C build/solc/0.8.27 aliases.sh -C ../../../src/solc start.sh
build/busybox-%-bounty/aliases.sh:
mkdir -p $(@D)
printf "$(ALIAS_TEMPLATE)" busybox busybox $* > $@

build/solc/0.8.27/aliases.sh: | build/solc/0.8.27
printf "$(ALIAS_TEMPLATE)" solc solc 0.8.27 > $@
###################
# Solidity
###################

build/solc/0.8.27:
mkdir -p $@
SOLC_VERSIONS= 0.8.27

dist:
mkdir -p $@
all: $(patsubst %,dist/solc-%-bounty.tar.xz,$(SOLC_VERSIONS))

.PHONY: clean
clean:
rm -rf build
dist/solc-%-bounty.tar.xz: build/solc-%-bounty/aliases.sh src/solc/start.sh
mkdir -p $(@D)
tar $(TAR_OPTS) $@ $^

.PHONY: distclean
distclean: clean
rm -rf dist
build/solc-%-bounty/aliases.sh:
mkdir -p $(@D)
printf "$(ALIAS_TEMPLATE)" solc solc $* > $@

0 comments on commit 7bc7894

Please sign in to comment.