1 | # Amstrad CPC generic makefile rules
|
---|
2 | # Copyright 2011-2012, Shinra Team
|
---|
3 | # Distributed under the terms of the MIT Licence
|
---|
4 | #
|
---|
5 | # Targets the vasm compiler (z80,oldstyle) and vlink tool.
|
---|
6 | # Also uses cpcfs, png2crtc, exomizer, caprice
|
---|
7 | #
|
---|
8 | # Just make a dsk file depend on some BIN files, and these depend on some .o files.
|
---|
9 | # Don't forget to set START for each BIN file (used as the start address for linking
|
---|
10 | # and put in the AMSDOS header)
|
---|
11 |
|
---|
12 | .DEFAULT_GOAL := $(NAME).dsk
|
---|
13 |
|
---|
14 | # Nice header for doing something
|
---|
15 | BECHO = @echo -e "\x1B[7m\t$(1)\t\x1B[0m"
|
---|
16 |
|
---|
17 | # Build the DSK-File (main rule)
|
---|
18 | %.dsk:
|
---|
19 | $(call BECHO, "Putting files in DSK...")
|
---|
20 | cpcfs $@ f
|
---|
21 | for i in $^;do cpcfs $@ p $$i;done;
|
---|
22 |
|
---|
23 | # Run the emulator
|
---|
24 | emu: $(NAME).dsk
|
---|
25 | $(call BECHO,"Running caprice...")
|
---|
26 | caprice -a $< &
|
---|
27 |
|
---|
28 | # Link the sources ($^ means "all dependencies", so all of them should be .o
|
---|
29 | # files - which is good, since anything else should be incbined somewhere)
|
---|
30 | %.BIN:
|
---|
31 | $(call BECHO,"Linking $@")
|
---|
32 | vlink -Ttext $(START) -Tlink.ld -b amsdos -o $@ $^
|
---|
33 |
|
---|
34 | #-Ttext $(START)
|
---|
35 |
|
---|
36 | # Assemble the sources
|
---|
37 | %.o: %.z80
|
---|
38 | $(call BECHO,"Assembling $<...")
|
---|
39 | vasmz80_oldstyle -Fvobj -o $@ $<
|
---|
40 |
|
---|
41 | # Crunch a screen
|
---|
42 | %.exo: %.scr
|
---|
43 | $(call BECHO,"Crunching $<...")
|
---|
44 | exoraw -o $@ $<
|
---|
45 |
|
---|
46 | # convert png to cpc screen format
|
---|
47 | # SCREENMODE can force the screenmode, otherwise it's guessed from the png
|
---|
48 | # bitdepth
|
---|
49 | %.scr: %.png
|
---|
50 | $(call BECHO,"Converting $<...")
|
---|
51 | png2crtc $< $@ 7 $(SCREENMODE)
|
---|
52 |
|
---|
53 | clean:
|
---|
54 | $(call BECHO,"Cleaning...")
|
---|
55 | rm *.exo *.BIN *.dsk *.o
|
---|