aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2024-12-09 14:56:39 +0100
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-02-04 21:12:23 +0100
commit7d8da8b4fb9826ce21dbe821596509823f7ec16f (patch)
tree1ebce6651312b58ea939013c964033c349e130f3
parent4cfc79f145b7c620a2688f4a755d5e53c7ef0e9d (diff)
downloadcode.nes-7d8da8b4fb9826ce21dbe821596509823f7ec16f.tar.gz
code.nes-7d8da8b4fb9826ce21dbe821596509823f7ec16f.zip
Clean up the Makefile output
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à <mikisabate@gmail.com>
-rw-r--r--Makefile43
-rw-r--r--README.md4
-rw-r--r--space/Makefile15
3 files changed, 30 insertions, 32 deletions
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 $@