From d6243f08e066831f13dc6de0e36d5761c443f92b Mon Sep 17 00:00:00 2001 From: Matteias Collet Date: Sun, 27 Nov 2022 03:57:16 +0000 Subject: [PATCH] allow game ID as version identifier --- .github/Build.Dockerfile | 6 +++--- .github/workflows/build.yml | 12 ++++++------ Makefile | 19 ++++++++++++++++--- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/Build.Dockerfile b/.github/Build.Dockerfile index b13856d..f7e5e42 100644 --- a/.github/Build.Dockerfile +++ b/.github/Build.Dockerfile @@ -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} \ No newline at end of file +ENTRYPOINT make GAME_VERSION=${GAME_VERSION} \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c9a7443..3b3fcb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index 8228a24..46a0a63 100644 --- a/Makefile +++ b/Makefile @@ -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) \ No newline at end of file