1 | CROSS_DIR := /opt/cross-m68k/bin
|
---|
2 | CROSS_TRI := m68k-none-elf
|
---|
3 | CROSS_PRE := $(CROSS_DIR)/$(CROSS_TRI)
|
---|
4 |
|
---|
5 | CROSS_GCC := $(CROSS_PRE)-gcc
|
---|
6 | CROSS_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 |
|
---|
11 | FLAGS := -Os -m68000 -mshort -Wall -Wextra \
|
---|
12 | -Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \
|
---|
13 | -Wshadow -Wmissing-declarations -Wredundant-decls \
|
---|
14 | -I include
|
---|
15 |
|
---|
16 | FLAGS_COM := $(FLAGS) -std=c99 -ffreestanding \
|
---|
17 | -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer
|
---|
18 |
|
---|
19 | FLAGS_ASM := $(FLAGS)
|
---|
20 |
|
---|
21 | HEADERS := $(wildcard include/*.h)
|
---|
22 |
|
---|
23 | PROLOG_C := croot.c
|
---|
24 | PROLOG_S := fsmain.s
|
---|
25 |
|
---|
26 | PROLOG_CO := $(PROLOG_C:.c=.o)
|
---|
27 | PROLOG_SO := $(PROLOG_S:.s=.o)
|
---|
28 |
|
---|
29 | PROLOG_SRC := $(PROLOG_C:%=prolog/%) $(PROLOG_S:%=prolog/%)
|
---|
30 | PROLOG_OBJ := $(PROLOG_CO:%=build/%) $(PROLOG_SO:%=build/%)
|
---|
31 |
|
---|
32 | build/%.o: prolog/%.c $(HEADERS) | build
|
---|
33 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
34 |
|
---|
35 | build/%.o: prolog/%.s $(HEADERS) | build
|
---|
36 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
37 |
|
---|
38 | IOLIB_C := dofmt.c mdump.c pause.c printf.c rawio.c sprintf.c waitcr.c
|
---|
39 | IOLIB_S := hwdefs.s rtraps.s setipl.s setsr.s traps.s
|
---|
40 |
|
---|
41 | IOLIB_CO := $(IOLIB_C:.c=.o)
|
---|
42 | IOLIB_SO := $(IOLIB_S:.s=.o)
|
---|
43 |
|
---|
44 | IOLIB_SRC := $(IOLIB_C:%=iolib/%) $(IOLIB_S:%=iolib/%)
|
---|
45 | IOLIB_OBJ := $(IOLIB_CO:%=build/%) $(IOLIB_SO:%=build/%)
|
---|
46 |
|
---|
47 | build/%.o: iolib/%.c $(HEADERS) | build
|
---|
48 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
49 |
|
---|
50 | build/%.o: iolib/%.s $(HEADERS) | build
|
---|
51 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
52 |
|
---|
53 | LIBCIO_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 |
|
---|
60 | LIBCIO_S := ptcl12.s
|
---|
61 |
|
---|
62 | LIBCIO_CO := $(LIBCIO_C:.c=.o)
|
---|
63 | LIBCIO_SO := $(LIBCIO_S:.s=.o)
|
---|
64 |
|
---|
65 | LIBCIO_SRC := $(LIBCIO_C:%=libcio/%) $(LIBCIO_S:%=libcio/%)
|
---|
66 | LIBCIO_OBJ := $(LIBCIO_CO:%=build/%) $(LIBCIO_SO:%=build/%)
|
---|
67 |
|
---|
68 | build/%.o: libcio/%.c $(HEADERS) | build
|
---|
69 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
70 |
|
---|
71 | build/%.o: libcio/%.s $(HEADERS) | build
|
---|
72 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
73 |
|
---|
74 | LIBSM_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 |
|
---|
80 | LIBSM_CO := $(LIBSM_C:.c=.o)
|
---|
81 |
|
---|
82 | LIBSM_SRC := $(LIBSM_C:%=libsm/%)
|
---|
83 | LIBSM_OBJ := $(LIBSM_CO:%=build/%)
|
---|
84 |
|
---|
85 | build/%.o: libsm/%.c $(HEADERS) | build
|
---|
86 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
87 |
|
---|
88 | LIB700_C := bitrev.c ctype.c ispow2.c mangle.c micons.c tolower.c toupper.c
|
---|
89 |
|
---|
90 | LIB700_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 |
|
---|
93 | LIB700_CO := $(LIB700_C:.c=.o)
|
---|
94 | LIB700_SO := $(LIB700_S:.s=.o)
|
---|
95 |
|
---|
96 | LIB700_SRC := $(LIB700_C:%=lib700/%) $(LIB700_S:%=lib700/%)
|
---|
97 | LIB700_OBJ := $(LIB700_CO:%=build/%) $(LIB700_SO:%=build/%)
|
---|
98 |
|
---|
99 | build/%.o: lib700/%.c $(HEADERS) | build
|
---|
100 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
101 |
|
---|
102 | build/%.o: lib700/%.s $(HEADERS) | build
|
---|
103 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
104 |
|
---|
105 | VLIB_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 |
|
---|
109 | VLIB_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 |
|
---|
113 | VLIB_CO := $(VLIB_C:.c=.o)
|
---|
114 | VLIB_SO := $(VLIB_S:.s=.o)
|
---|
115 |
|
---|
116 | VLIB_SRC := $(VLIB_C:%=vlib/%) $(VLIB_S:%=vlib/%)
|
---|
117 | VLIB_OBJ := $(VLIB_CO:%=build/%) $(VLIB_SO:%=build/%)
|
---|
118 |
|
---|
119 | build/%.o: vlib/%.c $(HEADERS) | build
|
---|
120 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
121 |
|
---|
122 | build/%.o: vlib/%.s $(HEADERS) | build
|
---|
123 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
124 |
|
---|
125 | all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
|
---|
126 | $(VLIB_OBJ)
|
---|
127 |
|
---|
128 | ROM_C := booter.c romp.c
|
---|
129 | ROM_S := bios.s timeint.s
|
---|
130 |
|
---|
131 | ROM_CO := $(ROM_C:.c=.o)
|
---|
132 | ROM_SO := $(ROM_S:.s=.o)
|
---|
133 |
|
---|
134 | ROM_SRC := $(ROM_C:%=rom/%) $(ROM_S:%=rom/%)
|
---|
135 | ROM_OBJ := $(ROM_CO:%=build/%) $(ROM_SO:%=build/%)
|
---|
136 |
|
---|
137 | build/%.o: rom/%.c $(HEADERS) | build
|
---|
138 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
139 |
|
---|
140 | build/%.o: rom/%.s $(HEADERS) | build
|
---|
141 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
142 |
|
---|
143 | RAM_C := addfpu.c adfield.c adselbx.c asgdsp.c asgvce.c barbadj.c chgsef.c \
|
---|
144 | chksec.c cminit.c ctcpos.c curset.c dbentr.c dcopy.c dec2fr.c delnote.c \
|
---|
145 | delpnts.c dformat.c dopatch.c enterit.c etaccn.c etadep.c etadyn.c \
|
---|
146 | etagch.c etagpt.c etains.c etaint.c etaopt.c etaprg.c etarat.c etatab.c \
|
---|
147 | etatun.c etavgr.c etdyn.c etiact.c eticnf.c etidin.c etimlt.c etinst.c \
|
---|
148 | etioas.c etiosc.c etipnt.c etires.c etitim.c etival.c etivce.c etiwsn.c \
|
---|
149 | etloc.c etmcfn.c etrel.c etres1.c etscor.c etsnbt.c etstrn.c ettpch.c \
|
---|
150 | ettrns.c etttab.c ettval.c etvel.c etwavs.c etwhar.c etwhrv.c etwoff.c \
|
---|
151 | etwpnt.c etwslt.c etwvce.c fcnote.c frfind.c gcurpos.c idfield.c idselbx.c \
|
---|
152 | im700.c infield.c initi.c instdsp.c itcpos.c kbobj.c lcdlbls.c ldfield.c \
|
---|
153 | ldselbx.c libdsp.c librw.c localkb.c m7menu.c midas.c msl.c msm.c nedacc.c \
|
---|
154 | pix2mid.c ptdisp.c ptdkey.c ptfield.c ptread.c ptselbx.c ptwrite.c puteq.c \
|
---|
155 | rscript.c scadv.c scfield.c scgoto.c scinit.c scope.c scordsp.c scread.c \
|
---|
156 | scselbx.c sctrak.c scwrite.c seccpy.c sedump.c select.c sendval.c setgc.c \
|
---|
157 | setv2gi.c setwq.c showcfg.c smscrl.c sqdisp.c sqdkey.c sqexec.c sqfield.c \
|
---|
158 | sqread.c sqscan.c sqselbx.c sqwrite.c stcpos.c stmproc.c swinit.c tdfield.c \
|
---|
159 | tdselbx.c ttcpos.c tundsp.c ucslice.c uslice.c vtyper.c wdfield.c wdselbx.c \
|
---|
160 | wheel.c wscalc.c wsdsp.c
|
---|
161 |
|
---|
162 | RAM_S := execins.s execkey.s fpuint.s procpfl.s sedisp.s seexec.s serintr.s \
|
---|
163 | sreset.s timeint.s tofpu.s
|
---|
164 |
|
---|
165 | RAM_CO := $(RAM_C:.c=.o)
|
---|
166 | RAM_SO := $(RAM_S:.s=.o)
|
---|
167 |
|
---|
168 | RAM_SRC := $(RAM_C:%=rom/%) $(RAM_S:%=rom/%)
|
---|
169 | RAM_OBJ := $(RAM_CO:%=build/%) $(RAM_SO:%=build/%)
|
---|
170 |
|
---|
171 | build/%.o: ram/%.c $(HEADERS) | build
|
---|
172 | $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
|
---|
173 |
|
---|
174 | build/%.o: ram/%.s $(HEADERS) | build
|
---|
175 | $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
|
---|
176 |
|
---|
177 | all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
|
---|
178 | $(VLIB_OBJ) $(ROM_OBJ) $(RAM_OBJ)
|
---|
179 |
|
---|
180 | build:
|
---|
181 | mkdir build
|
---|
182 |
|
---|
183 | hatari/c.img: $(wildcard hatari/c/bin/*) $(wildcard hatari/c/work/*)
|
---|
184 | rm -f hatari/c.img
|
---|
185 | atari-hd-image 8 hatari/c.img BUCHLA hatari/c
|
---|
186 |
|
---|
187 | emu: hatari/c.img
|
---|
188 | hatari \
|
---|
189 | --control-socket /tmp/buchla.sock \
|
---|
190 | --vdi-width 1280 --vdi-height 960 \
|
---|
191 | --drive-a false --drive-b false \
|
---|
192 | --acsi 0=hatari/c.img \
|
---|
193 | --harddrive hatari/d --gemdos-drive d
|
---|
194 |
|
---|
195 | rem:
|
---|
196 | hatari/rem.py
|
---|
197 |
|
---|
198 | clean:
|
---|
199 | rm -rf build
|
---|
200 | rm -f hatari/c.img
|
---|
201 | rm -f hatari/d/out/*
|
---|