source: buchla-68k/Makefile@ 283e7a6

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

Added version file.

  • Property mode set to 100644
File size: 6.8 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
[bef53a9]11FLAGS := -Os -m68000 -Wall -Wextra
12
13FLAGS_COM := $(FLAGS) -mshort -std=c99 -ffreestanding \
14 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \
[109c83b]15 -Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \
16 -Wshadow -Wmissing-declarations -Wredundant-decls \
17 -I include
18
[bef53a9]19FLAGS_ASM := $(FLAGS) -Wa,--register-prefix-optional
[109c83b]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
[bef53a9]129ROM_S := bios.s lowram.s timeint.s
[109c83b]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
[c65a0e2]143RAM_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
162RAM_S := execins.s execkey.s fpuint.s procpfl.s sedisp.s seexec.s serintr.s \
[283e7a6]163 sreset.s timeint.s tofpu.s verdate.s
[c65a0e2]164
165RAM_CO := $(RAM_C:.c=.o)
166RAM_SO := $(RAM_S:.s=.o)
167
168RAM_SRC := $(RAM_C:%=rom/%) $(RAM_S:%=rom/%)
169RAM_OBJ := $(RAM_CO:%=build/%) $(RAM_SO:%=build/%)
170
171build/%.o: ram/%.c $(HEADERS) | build
172 $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $<
173
174build/%.o: ram/%.s $(HEADERS) | build
175 $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $<
176
[109c83b]177all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
[c65a0e2]178 $(VLIB_OBJ) $(ROM_OBJ) $(RAM_OBJ)
[109c83b]179
180build:
181 mkdir build
182
[f8c95c4]183hatari/c.img: $(wildcard hatari/c/bin/*) $(wildcard hatari/c/work/*)
[109c83b]184 rm -f hatari/c.img
[bef53a9]185 atari-hd-image 16 hatari/c.img BUCHLA hatari/c
[109c83b]186
187emu: hatari/c.img
188 hatari \
189 --control-socket /tmp/buchla.sock \
[bef53a9]190 --memsize 14 \
[109c83b]191 --vdi-width 1280 --vdi-height 960 \
192 --drive-a false --drive-b false \
193 --acsi 0=hatari/c.img \
194 --harddrive hatari/d --gemdos-drive d
195
196rem:
197 hatari/rem.py
198
199clean:
200 rm -rf build
201 rm -f hatari/c.img
202 rm -f hatari/d/out/*
Note: See TracBrowser for help on using the repository browser.