Reputation: 1618
First ever attempt at writing a small Makefile, but hitting a problem - how do I stop it executing make clean after every build?
TASS64=64tass
EXOMIZER=exomizer
EXOMIZERFLAGS=sfx basic -n
VICE=/Applications/VICE/x64.app/Contents/MacOS/x64
VICEFLAGS=-sidenginemodel 1803 -keybuf "\88"
SOURCES=$(wildcard *.asm)
OBJECTS=$(SOURCES:.asm=.prg)
.PRECIOUS=Calvin.prg
all: $(TARGETS)
%.prg: %.asm
$(TASS64) -C -a -o $@ -i $<
%: %.prg
$(VICE) $(VICEFLAGS) $<
.PHONY: clean
clean:
rm $(OBJECTS)
Upvotes: 1
Views: 981
Reputation: 3352
I guess, it does not execute 'make clean'. However, what may happen is that intermediate (secondary) results are deleted. GNU Make does that by default. To prevent make from doing so, mention those intermediate results X1, X2, ...
in
.SECONDARY: X1 X2 ...
Or, in order to leave any secondary result in place, simply type:
.SECONDARY:
without any specific target.
Upvotes: 3
Reputation: 1618
So it turns out the default Make behaviour is to delete the output if there's a build problem. While it builds correctly in this case, my makefile then launches the PRG file in VICE (c64 emulator). It runs correctly, so I quit the emulator.
The quit action returns an exit code that Make treats as an unsuccessful build and thus deletes the output PRG
This is based on this thread - Why does GNU make delete a file - and subsequent testing by removing the target that launches VICE.
Upvotes: 0