allow game ID as version identifier

This commit is contained in:
Matteias Collet 2022-11-27 03:57:16 +00:00 committed by GitHub
parent 011d2f9d35
commit d6243f08e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 12 deletions

View file

@ -1,11 +1,11 @@
FROM devkitpro/devkitppc:20210726
ARG VERSION
ARG GAME_VERSION
ENV PATH="${PATH}:/opt/devkitpro/devkitPPC/bin"
ENV VERSION=${VERSION}
ENV GAME_VERSION=${GAME_VERSION}
RUN apt-get update && apt-get install make
WORKDIR /build
ENTRYPOINT make VERSION=${VERSION}
ENTRYPOINT make GAME_VERSION=${GAME_VERSION}

View file

@ -11,20 +11,20 @@ jobs:
fail-fast: false
matrix:
version:
- 1
- 2
- 3
- 4
- GMSE01
- GMSJ01
- GMSP01
- GMSJ0A
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker Image
run: docker build --build-arg VERSION=${{ matrix.version }} -t build:base -f ./.github/Build.Dockerfile .
run: docker build --build-arg GAME_VERSION=${{ matrix.version }} -t build:base -f ./.github/Build.Dockerfile .
- name: Build Project
run: docker run --mount type=bind,source="$(pwd)",target=/build build:base
- name: Upload Artifactes
uses: actions/upload-artifact@master
with:
name: build-artifact
name: build-output-${{ matrix.version }}
path: out
retention-days: 7

View file

@ -1,5 +1,5 @@
CC := powerpc-eabi-gcc
CFLAGS := -D VERSION=${VERSION} -Os -I. -Wa,-mregnames,-mgekko -Wall -fno-asynchronous-unwind-tables -fno-unwind-tables
CFLAGS := -Os -I. -Wa,-mregnames,-mgekko -Wall -fno-asynchronous-unwind-tables -fno-unwind-tables
AS := powerpc-eabi-as
ASFLAGS := -mregnames -mgekko
@ -25,6 +25,13 @@ OUT_MAIN := main.out
OUT_BIN := main.bin
OUT_ASM := main.asm
GMSE01 := 1
GMSJ01 := 2
GMSP01 := 3
GMSJ0A := 4
TARGET_VERSION = $($(GAME_VERSION))
SRC_FILES := $(wildcard source/*.c)
OBJ_FILES := $(SRC_FILES:.c=.o)
@ -42,12 +49,18 @@ $(OUT_DIR)/$(OUT_BIN): $(OUT_DIR)/$(OUT_MAIN)
$(OUT_DIR)/$(OUT_MAIN): $(OBJ_FILES) $(LD_FILE) $(OUT_DIR)
$(LD) $(LDFLAGS) -o $@ -T $(LD_FILE) -Map $(OUT_DIR)/$(OUT_MAP) $(OBJ_FILES)
$(OBJ_FILES): $(SRC_FILES)
$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $(@:.o=.c)
$(OBJ_FILES): $(SRC_FILES) check-set-TARGET_VERSION
$(CC) $(CFLAGS) -D VERSION=$(TARGET_VERSION) -I $(INC_DIR) -o $@ -c $(@:.o=.c)
$(OUT_DIR):
mkdir -p $@
check-set-%:
@ if [ "${${*}}" = "" ]; then \
echo "Variable $* not set"; \
exit 1; \
fi
.PHONY: clean
clean:
$(RM) -rv $(OUT_DIR) $(OBJ_FILES)