[109c83b] | 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 | all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \
|
---|
| 144 | $(VLIB_OBJ) $(ROM_OBJ)
|
---|
| 145 |
|
---|
| 146 | build:
|
---|
| 147 | mkdir build
|
---|
| 148 |
|
---|
| 149 | hatari/c.img: $(wildcard hatari/c/bin/*)
|
---|
| 150 | rm -f hatari/c.img
|
---|
| 151 | atari-hd-image 8 hatari/c.img BUCHLA hatari/c
|
---|
| 152 |
|
---|
| 153 | emu: 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 |
|
---|
| 161 | rem:
|
---|
| 162 | hatari/rem.py
|
---|
| 163 |
|
---|
| 164 | clean:
|
---|
| 165 | rm -rf build
|
---|
| 166 | rm -f hatari/c.img
|
---|
| 167 | rm -f hatari/d/out/*
|
---|