mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
Merge pull request #202 from yenatch/rgbasm-objects
makefile: support multiple rgbasm objects
This commit is contained in:
commit
18656332b7
45
Makefile
45
Makefile
@ -1,37 +1,49 @@
|
||||
PYTHON := python
|
||||
.SUFFIXES: .asm .tx .o .gbc .png .2bpp .lz
|
||||
.PHONY: all clean pngs gfx
|
||||
.SECONDEXPANSION:
|
||||
|
||||
TEXTFILES := $(shell find ./ -type f -name '*.asm' | grep -v pokecrystal.asm | grep -v constants.asm | grep -v gbhw.asm | grep -v hram.asm | grep -v constants | grep -v wram.asm)
|
||||
TEXTFILES := $(shell find ./ -type f -name '*.asm')
|
||||
TEXTQUEUE :=
|
||||
|
||||
PNG_GFX := $(shell find gfx/ -type f -name '*.png')
|
||||
LZ_GFX := $(shell find gfx/ -type f -name '*.lz')
|
||||
TWOBPP_GFX := $(shell find gfx/ -type f -name '*.2bpp')
|
||||
OBJS := pokecrystal.o
|
||||
|
||||
PNGS := $(shell find gfx/ -type f -name '*.png')
|
||||
LZS := $(shell find gfx/ -type f -name '*.lz')
|
||||
_2BPPS := $(shell find gfx/ -type f -name '*.2bpp')
|
||||
_1BPPS := $(shell find gfx/ -type f -name '*.1bpp')
|
||||
|
||||
$(shell $(foreach obj, $(OBJS), $(eval OBJ_$(obj:.o=) := $(shell $(PYTHON) scan_includes.py $(obj:.o=.asm)))))
|
||||
|
||||
all: baserom.gbc pokecrystal.gbc
|
||||
cmp baserom.gbc pokecrystal.gbc
|
||||
clean:
|
||||
rm -f pokecrystal.o pokecrystal.gbc
|
||||
@echo 'rm -f $(TEXTFILES:.asm=.tx)'
|
||||
@echo 'Removing preprocessed .tx files...'
|
||||
@rm -f $(TEXTFILES:.asm=.tx)
|
||||
pokecrystal.o: $(TEXTFILES:.asm=.tx) wram.asm constants.asm $(shell find constants/ -type f -name '*.asm') hram.asm gbhw.asm $(LZ_GFX) $(TWOBPP_GFX)
|
||||
$(PYTHON) prequeue.py $(TEXTQUEUE)
|
||||
rgbasm -o pokecrystal.o pokecrystal.asm
|
||||
|
||||
baserom.gbc:
|
||||
@echo "Wait! Need baserom.gbc first. Check README and INSTALL for details." && false
|
||||
|
||||
.asm.tx:
|
||||
$(eval TEXTQUEUE := $(TEXTQUEUE) $<)
|
||||
@rm -f $@
|
||||
baserom.gbc:
|
||||
$(PYTHON) -c "import os; assert 'baserom.gbc' in os.listdir('.'), 'Wait! Need baserom.gbc first. Check README and INSTALL for details.';"
|
||||
|
||||
pokecrystal.gbc: pokecrystal.o
|
||||
rgblink -n pokecrystal.sym -m pokecrystal.map -o $@ $<
|
||||
$(OBJS): $$(patsubst %.o,%.tx,$$@) $$(patsubst %.asm,%.tx,$$(OBJ_$$(patsubst %.o,%,$$@)))
|
||||
@echo "Preprocessing .asm to .tx..."
|
||||
@$(PYTHON) prequeue.py $(TEXTQUEUE)
|
||||
$(eval TEXTQUEUE := )
|
||||
rgbasm -o $@ $(@:.o=.tx)
|
||||
|
||||
pokecrystal.gbc: $(OBJS)
|
||||
rgblink -n pokecrystal.sym -m pokecrystal.map -o pokecrystal.gbc $<
|
||||
rgbfix -Cjv -i BYTE -k 01 -l 0x33 -m 0x10 -p 0 -r 3 -t PM_CRYSTAL $@
|
||||
|
||||
pngs:
|
||||
$(PYTHON) extras/pokemontools/gfx.py mass-decompress
|
||||
$(PYTHON) extras/pokemontools/gfx.py dump-pngs
|
||||
|
||||
lzs: $(LZ_GFX) $(TWOBPP_GFX)
|
||||
gfx: $(LZS) $(_2BPPS) $(_1BPPS)
|
||||
@:
|
||||
|
||||
gfx/pics/%/front.lz: gfx/pics/%/tiles.2bpp gfx/pics/%/front.png
|
||||
@ -46,4 +58,9 @@ gfx/trainers/%.lz: gfx/trainers/%.png
|
||||
$(PYTHON) extras/pokemontools/gfx.py png-to-lz $<
|
||||
.png.2bpp:
|
||||
$(PYTHON) extras/pokemontools/gfx.py png-to-lz $<
|
||||
|
||||
.png.1bpp:
|
||||
$(PYTHON) extras/pokemontools/gfx.py png-to-lz $<
|
||||
%.2bpp:
|
||||
@:
|
||||
%.1bpp:
|
||||
@:
|
||||
|
@ -6,6 +6,9 @@ else
|
||||
VERSION EQU 1
|
||||
endc
|
||||
|
||||
INCLUDE "gbhw.asm"
|
||||
INCLUDE "hram.asm"
|
||||
|
||||
INCLUDE "constants/pokemon_constants.asm"
|
||||
INCLUDE "constants/move_constants.asm"
|
||||
INCLUDE "constants/battle_constants.asm"
|
||||
|
16
main.asm
16
main.asm
@ -86589,7 +86589,7 @@ SECTION "bank6C",ROMX,BANK[$6C]
|
||||
|
||||
; Common text I
|
||||
|
||||
INCLUDE "text/common.tx"
|
||||
INCLUDE "text/common.asm"
|
||||
|
||||
; Map Scripts XXV
|
||||
|
||||
@ -86599,10 +86599,10 @@ INCLUDE "maps/Route10North.asm"
|
||||
|
||||
SECTION "bank6D",ROMX,BANK[$6D]
|
||||
|
||||
INCLUDE "text/phone/mom.tx"
|
||||
INCLUDE "text/phone/bill.tx"
|
||||
INCLUDE "text/phone/elm.tx"
|
||||
INCLUDE "text/phone/trainers1.tx"
|
||||
INCLUDE "text/phone/mom.asm"
|
||||
INCLUDE "text/phone/bill.asm"
|
||||
INCLUDE "text/phone/elm.asm"
|
||||
INCLUDE "text/phone/trainers1.asm"
|
||||
|
||||
|
||||
SECTION "bank6E",ROMX,BANK[$6E]
|
||||
@ -86617,21 +86617,21 @@ SECTION "bank6F",ROMX,BANK[$6F]
|
||||
|
||||
; Common text II
|
||||
|
||||
INCLUDE "text/common_2.tx"
|
||||
INCLUDE "text/common_2.asm"
|
||||
|
||||
|
||||
SECTION "bank70",ROMX,BANK[$70]
|
||||
|
||||
; Common text III
|
||||
|
||||
INCLUDE "text/common_3.tx"
|
||||
INCLUDE "text/common_3.asm"
|
||||
|
||||
|
||||
SECTION "bank71",ROMX,BANK[$71]
|
||||
|
||||
; Common text IV
|
||||
|
||||
INCLUDE "text/common_4.tx"
|
||||
INCLUDE "text/common_4.asm"
|
||||
|
||||
|
||||
SECTION "bank72",ROMX,BANK[$72]
|
||||
|
@ -1,5 +1,3 @@
|
||||
INCLUDE "wram.asm"
|
||||
INCLUDE "constants.asm"
|
||||
INCLUDE "gbhw.asm"
|
||||
INCLUDE "hram.asm"
|
||||
INCLUDE "main.tx"
|
||||
INCLUDE "main.asm"
|
||||
|
29
scan_includes.py
Normal file
29
scan_includes.py
Normal file
@ -0,0 +1,29 @@
|
||||
# coding: utf-8
|
||||
|
||||
"""
|
||||
Recursively scan an asm file for rgbasm INCLUDEs and INCBINs.
|
||||
This is used to generate dependencies for each rgbasm object file.
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
||||
def scan_for_includes(filename):
|
||||
filenames = []
|
||||
for line in open(filename, 'r').readlines():
|
||||
if 'INCLUDE' in line or 'INCBIN' in line:
|
||||
line = line.split(';')[0]
|
||||
if 'INCLUDE' in line or 'INCBIN' in line:
|
||||
filenames += [line.split('"')[1]]
|
||||
return filenames
|
||||
|
||||
def recursive_scan_for_includes(filename):
|
||||
filenames = []
|
||||
if '.asm' in filename or '.tx' in filename:
|
||||
for include in scan_for_includes(filename):
|
||||
filenames += [include] + recursive_scan_for_includes(include)
|
||||
return filenames
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
for arg in sys.argv[1:]:
|
||||
sys.stdout.write(' '.join(recursive_scan_for_includes(arg)))
|
||||
|
Loading…
Reference in New Issue
Block a user