source: buchla-68k/Makefile@ cbc2fcf

Last change on this file since cbc2fcf was 109c83b, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Compiled full ROM in Hatari.

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[109c83b]1CROSS_DIR := /opt/cross-m68k/bin
2CROSS_TRI := m68k-none-elf
3CROSS_PRE := $(CROSS_DIR)/$(CROSS_TRI)
4
5CROSS_GCC := $(CROSS_PRE)-gcc
6CROSS_AS := $(CROSS_PRE)-as
7
8# -mshort sets the size of an int to 16 bits; important for interop with
9# the hand-written assembly language code
10
11FLAGS := -Os -m68000 -mshort -Wall -Wextra \
12 -Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \
13 -Wshadow -Wmissing-declarations -Wredundant-decls \
14 -I include
15
16FLAGS_COM := $(FLAGS) -std=c99 -ffreestanding \
17 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer
18
19FLAGS_ASM := $(FLAGS)
20
21HEADERS := $(wildcard include/*.h)
22
23PROLOG_C := croot.c
24PROLOG_S := fsmain.s
25
26PROLOG_CO := $(PROLOG_C:.c=.o)
27PROLOG_SO := $(PROLOG_S:.s=.o)
28
29PROLOG_SRC := $(PROLOG_C:%=prolog/%) $(PROLOG_S:%=prolog/%)
30PROLOG_OBJ := $(PROLOG_CO:%=build/%) $(PROLOG_SO:%=build/%)
31
32build/%.o: prolog/%.c $(HEADERS) | build
33 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
34
35build/%.o: prolog/%.s $(HEADERS) | build
36 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
37
38IOLIB_C := dofmt.c mdump.c pause.c printf.c rawio.c sprintf.c waitcr.c
39IOLIB_S := hwdefs.s rtraps.s setipl.s setsr.s traps.s
40
41IOLIB_CO := $(IOLIB_C:.c=.o)
42IOLIB_SO := $(IOLIB_S:.s=.o)
43
44IOLIB_SRC := $(IOLIB_C:%=iolib/%) $(IOLIB_S:%=iolib/%)
45IOLIB_OBJ := $(IOLIB_CO:%=build/%) $(IOLIB_SO:%=build/%)
46
47build/%.o: iolib/%.c $(HEADERS) | build
48 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
49
50build/%.o: iolib/%.s $(HEADERS) | build
51 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
52
53LIBCIO_C := atoi.c atol.c blkrd.c blkwr.c close.c clusmap.c conin.c conwr.c \
54 dirfns.c fgets.c filesys.c filname.c flread.c fopen.c fprintf.c \
55 fputs.c fread.c fscanf.c fseek.c fsinit.c fsize.c fstubs.c ftell.c \
56 fwrite.c getbuff.c getc.c getl.c getw.c lseek.c open.c posit.c putc.c \
57 putl.c putw.c read.c readrn.c rename.c scan.c setbuf.c ungetc.c \
58 unlink.c write.c writern.c
59
60LIBCIO_S := ptcl12.s
61
62LIBCIO_CO := $(LIBCIO_C:.c=.o)
63LIBCIO_SO := $(LIBCIO_S:.s=.o)
64
65LIBCIO_SRC := $(LIBCIO_C:%=libcio/%) $(LIBCIO_S:%=libcio/%)
66LIBCIO_OBJ := $(LIBCIO_CO:%=build/%) $(LIBCIO_SO:%=build/%)
67
68build/%.o: libcio/%.c $(HEADERS) | build
69 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
70
71build/%.o: libcio/%.s $(HEADERS) | build
72 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
73
74LIBSM_C := index.c memccpy.c memchr.c memcmp.c memcmpu.c memcpy.c memcpyw.c \
75 memset.c memsetw.c rindex.c str2lc.c str2uc.c strcat.c strccpy.c \
76 strchr.c strcmp.c strcpy.c strcspn.c strfill.c strlcmp.c strlen.c \
77 strltrm.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strrev.c \
78 strrevi.c strrtrm.c strspn.c strtok.c strtol.c
79
80LIBSM_CO := $(LIBSM_C:.c=.o)
81
82LIBSM_SRC := $(LIBSM_C:%=libsm/%)
83LIBSM_OBJ := $(LIBSM_CO:%=build/%)
84
85build/%.o: libsm/%.c $(HEADERS) | build
86 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
87
88LIB700_C := bitrev.c ctype.c ispow2.c mangle.c micons.c tolower.c toupper.c
89
90LIB700_S := aldiv.s almul.s alrem.s blkfill.s blkmove.s finalone.s jumpto.s \
91 ldiv.s lmul.s lrem.s rand24.s setjmp.s uldiv.s
92
93LIB700_CO := $(LIB700_C:.c=.o)
94LIB700_SO := $(LIB700_S:.s=.o)
95
96LIB700_SRC := $(LIB700_C:%=lib700/%) $(LIB700_S:%=lib700/%)
97LIB700_OBJ := $(LIB700_CO:%=build/%) $(LIB700_SO:%=build/%)
98
99build/%.o: lib700/%.c $(HEADERS) | build
100 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
101
102build/%.o: lib700/%.s $(HEADERS) | build
103 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
104
105VLIB_C := cg2.c cg3.c glcinit.c lseg.c vbfill4.c vclrs.c vhinit.c vmput.c \
106 vobjfns.c vputs.c vputsv.c vsetpal.c vsinit.c vspray4.c vtext.c \
107 vwputm.c
108
109VLIB_S := acctrl.s glcplot.s tsplot4.s vbank.s vclrav.s vcputs.s vcputsv.s \
110 viint.s vputa.s vputc.s vputcv.s vputp.s vsetav.s vsetcv.s vsplot4.s \
111 vvputsv.s vwputp.s vwputs.s
112
113VLIB_CO := $(VLIB_C:.c=.o)
114VLIB_SO := $(VLIB_S:.s=.o)
115
116VLIB_SRC := $(VLIB_C:%=vlib/%) $(VLIB_S:%=vlib/%)
117VLIB_OBJ := $(VLIB_CO:%=build/%) $(VLIB_SO:%=build/%)
118
119build/%.o: vlib/%.c $(HEADERS) | build
120 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
121
122build/%.o: vlib/%.s $(HEADERS) | build
123 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
124
125all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
126 $(VLIB_OBJ)
127
128ROM_C := booter.c romp.c
129ROM_S := bios.s timeint.s
130
131ROM_CO := $(ROM_C:.c=.o)
132ROM_SO := $(ROM_S:.s=.o)
133
134ROM_SRC := $(ROM_C:%=rom/%) $(ROM_S:%=rom/%)
135ROM_OBJ := $(ROM_CO:%=build/%) $(ROM_SO:%=build/%)
136
137build/%.o: rom/%.c $(HEADERS) | build
138 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
139
140build/%.o: rom/%.s $(HEADERS) | build
141 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
142
143all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
144 $(VLIB_OBJ) $(ROM_OBJ)
145
146build:
147 mkdir build
148
149hatari/c.img: $(wildcard hatari/c/bin/*)
150 rm -f hatari/c.img
151 atari-hd-image 8 hatari/c.img BUCHLA hatari/c
152
153emu: hatari/c.img
154 hatari \
155 --control-socket /tmp/buchla.sock \
156 --vdi-width 1280 --vdi-height 960 \
157 --drive-a false --drive-b false \
158 --acsi 0=hatari/c.img \
159 --harddrive hatari/d --gemdos-drive d
160
161rem:
162 hatari/rem.py
163
164clean:
165 rm -rf build
166 rm -f hatari/c.img
167 rm -f hatari/d/out/*
Note: See TracBrowser for help on using the repository browser.