Skip to content

Commit

Permalink
Streamline makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
kubilus1 committed Dec 9, 2022
1 parent d187d6c commit 93410dd
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 1,982 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/push-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
tileset:
type: choice
options:
- sa
- na
- aus_pac
- eur
Expand All @@ -27,7 +28,7 @@ jobs:
- name: Gen tile sub-lists
id: chunks
run: |
make ${{ inputs.tileset }}_tile_list_chunks
TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.tileset }}_tile_list_chunks
CHUNKS=$(ls ${{ inputs.tileset }}_tile_list.* | awk -F '.' '/.+/ { printf "%s\"z_${{ inputs.tileset }}_%s.zip\"", sep, ""$2""; sep=", " }')
#CHUNKS=$(ls ${{ inputs.tileset }}_tile_list.* | awk -v ORS=',' '{print $1}')
echo "chunks={\"chunk\":[$CHUNKS]}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -66,16 +67,16 @@ jobs:
- name: Test
run: |
make ${{ inputs.tileset }}_tile_list_chunks
make -n ${{ matrix.chunk }}
TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.tileset }}_tile_list_chunks
TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ matrix.chunk }}
- name: Setup Ortho4XP
run: make Ortho4XP
run: TILENAME=${{ inputs.tileset }} make Ortho4XP

- name: Build
run: |
make ${{ inputs.tileset }}_tile_list_chunks
make -j 2 ${{ matrix.chunk }}
TILENAME=${{ inputs.tileset }} make -f Makefile.tiles ${{ inputs.tileset }}_tile_list_chunks
TILENAME=${{ inputs.tileset }} make -f Makefile.tiles -j 2 ${{ matrix.chunk }}
if: startsWith(github.ref, 'refs/tags/')

- name: Release
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*~
*.swp
Ortho4XP
*_tile_list.*
63 changes: 63 additions & 0 deletions Makefile.tiles
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
SPLITSIZE?=150

TILENAME?=test

TILES:=$(addprefix z_$(TILENAME)_, $(shell ls $(TILENAME)_tile_list.* | awk -F. '{ print $$2 }') )
TILE_ZIPS=$(addsuffix .zip, $(TILES))

ZIPS=$(TILE_ZIPS)

# Get the tiles listed in each list file
.SECONDEXPANSION:
TILE_FILES = $(addprefix Ortho4XP/Tiles/zOrtho4XP_, $(basename $(shell cat $(TILENAME)_tile_list.$* ) ) )


all: $(ZIPS)

z_$(TILENAME)_%: $(TILENAME)_tile_list.% $${TILE_FILES}
echo "Going to do some $@"

#
# Ortho4XP setup
#

ortho4xp.diff:
cd Ortho4XP && git diff > ../ortho4xp.diff

Ortho4XP:
git clone --depth=1 https://github.com/oscarpilote/Ortho4XP.git
cd $@ && patch -p1 -u < ../ortho4xp.diff
cp extract_overlay.py $@/.
cp Ortho4XP.cfg $@/.
mkdir $@/tmp


#$(TILENAME)_tile_list.%: $(TILENAME)_tile_list_chunks
$(TILENAME)_tile_list_chunks: $(TILENAME)_tile_list
split $< -d -l $(SPLITSIZE) $<.


#
# Tile pack setup
#

Ortho4XP/Tiles/zOrtho4XP_%: Ortho4XP
@echo "Make tile $@"
set -e;\
export COORDS=$$(echo $@ | sed -e 's/.*_\([-+][0-9]\+\)\([-+][0-9]\+\)/\1 \2/g');\
cd $< && python3 Ortho4XP_v130.py $$COORDS BI 16

# Static pattern rule for the zip files
$(ZIPS): z_%.zip: z_%
mkdir -p $<
cp -r Ortho4XP/Tiles/zOrtho4XP_*/'Earth nav data' $</.
cp -r Ortho4XP/Tiles/zOrtho4XP_*/terrain $</.
cp -r Ortho4XP/Tiles/zOrtho4XP_*/textures $</.
cp ORTHO_SETUP.md $</.
zip -r $@ $<

clean:
-rm -rf Ortho4XP
-rm $(ZIPS)
-rm -rf z_$(TILENAME)
-rm $(TILENAME)_tile_list.*
Loading

0 comments on commit 93410dd

Please sign in to comment.