From 7d8da8b4fb9826ce21dbe821596509823f7ec16f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 9 Dec 2024 14:56:39 +0100 Subject: Clean up the Makefile output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also involves moving the target for the `space` example to the general Makefile. The Makefile is not as clear as I'd like, but at least it's not a mess (yet). Signed-off-by: Miquel Sabaté Solà --- Makefile | 43 ++++++++++++++++++++++++++++--------------- README.md | 4 ++-- space/Makefile | 15 --------------- 3 files changed, 30 insertions(+), 32 deletions(-) delete mode 100644 space/Makefile diff --git a/Makefile b/Makefile index bb5c572..179ee62 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,13 @@ +V = +ifeq ($(strip $(V)),) + E = @echo + Q = @ +else + E = @\# + Q = +endif + CC65 ?= cl65 -CA65 ?= ca65 -LD65 ?= ld65 CCOPTS ?= --target nes .PHONY: all @@ -22,24 +29,30 @@ build: basics space scroll .PHONY: basics basics: - $(CC65) $(CCOPTS) basics/sprite.s -o out/basics/sprite.nes - $(CC65) $(CCOPTS) basics/input.s -o out/basics/input.nes - $(CC65) $(CCOPTS) basics/persist.s -o out/basics/persist.nes - $(CC65) $(CCOPTS) basics/flicker.s -o out/basics/flicker.nes + $(E) " CC basics/sprite" + $(Q) $(CC65) $(CCOPTS) basics/sprite.s -o out/basics/sprite.nes + + $(E) " CC basics/input" + $(Q) $(CC65) $(CCOPTS) basics/input.s -o out/basics/input.nes + + $(E) " CC basics/persist" + $(Q) $(CC65) $(CCOPTS) basics/persist.s -o out/basics/persist.nes + + $(E) " CC basics/flicker" + $(Q) $(CC65) $(CCOPTS) basics/flicker.s -o out/basics/flicker.nes - $(CA65) $(CCOPTS) basics/unrom.s -o basics/unrom.o - $(LD65) basics/unrom.o -C config/unrom.cfg -o out/basics/unrom.nes - @rm -f basics/unrom.o + $(E) " CC basics/unrom" + $(Q) $(CC65) $(CCOPTS) basics/unrom.s -C config/unrom.cfg -o out/basics/unrom.nes - $(CA65) $(CCOPTS) basics/chr-ram.s -o basics/chr-ram.o - $(LD65) basics/chr-ram.o -C config/unrom.cfg -o out/basics/chr-ram.nes - @rm -f basics/chr-ram.o + $(E) " CC basics/chr-ram" + $(Q) $(CC65) $(CCOPTS) basics/chr-ram.s -C config/unrom.cfg -o out/basics/chr-ram.nes .PHONY: space space: - @cd space && CC65=$(CC65) CCOPTS="$(CCOPTS)" $(MAKE) - @mv space/space.nes out/space/ + $(E) " CC space" + $(Q) $(CC65) $(CCOPTS) space/src/space.s -o out/space/space.nes .PHONY: scroll scroll: - $(CC65) $(CCOPTS) scroll/level.s -o out/scroll/level.nes + $(E) " CC scroll" + $(Q) $(CC65) $(CCOPTS) scroll/level.s -o out/scroll/level.nes diff --git a/README.md b/README.md index d239e28..f4fa51d 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ You can build everything by just calling `make` and binaries will then be available in the `out` directory. Before doing that, though, you will need a compiler for the 6052 platform. A good option is [cc65](https://github.com/cc65/cc65), which is available on all major platforms. -Otherwise, if you want to use another compiler, you can pass the `CC65` and -`CCOPTS` variables to the Makefile. +Otherwise, if you want to use another compiler, you can pass the `CC65`, `CA65`, +`LD65` and `CCOPTS` variables to the Makefile. After that, it's recommended that you run the ROMs with an emulator with debugging support or at least some form of memory visualization. This is because diff --git a/space/Makefile b/space/Makefile deleted file mode 100644 index e38607c..0000000 --- a/space/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -CC65 ?= cl65 -CCOPTS ?= --verbose --target nes - -.PHONY: all -all: clean build - -.PHONY: clean -clean: - @rm -f space.nes - -.PHONY: build -build: space.nes - -%.nes: src/%.s - $(CC65) $(CCOPTS) $< -o $@ -- cgit v1.2.3