CROSS_DIR := /opt/cross-m68k/bin CROSS_TRI := m68k-none-elf CROSS_PRE := $(CROSS_DIR)/$(CROSS_TRI) CROSS_GCC := $(CROSS_PRE)-gcc CROSS_AS := $(CROSS_PRE)-as # -mshort sets the size of an int to 16 bits; important for interop with # the hand-written assembly language code FLAGS := -Os -m68000 -mshort -Wall -Wextra \ -Wpedantic -Wcast-align -Wcast-qual -Wconversion -Wsign-conversion \ -Wshadow -Wmissing-declarations -Wredundant-decls \ -I include FLAGS_COM := $(FLAGS) -std=c99 -ffreestanding \ -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer FLAGS_ASM := $(FLAGS) HEADERS := $(wildcard include/*.h) PROLOG_C := croot.c PROLOG_S := fsmain.s PROLOG_CO := $(PROLOG_C:.c=.o) PROLOG_SO := $(PROLOG_S:.s=.o) PROLOG_SRC := $(PROLOG_C:%=prolog/%) $(PROLOG_S:%=prolog/%) PROLOG_OBJ := $(PROLOG_CO:%=build/%) $(PROLOG_SO:%=build/%) build/%.o: prolog/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: prolog/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< IOLIB_C := dofmt.c mdump.c pause.c printf.c rawio.c sprintf.c waitcr.c IOLIB_S := hwdefs.s rtraps.s setipl.s setsr.s traps.s IOLIB_CO := $(IOLIB_C:.c=.o) IOLIB_SO := $(IOLIB_S:.s=.o) IOLIB_SRC := $(IOLIB_C:%=iolib/%) $(IOLIB_S:%=iolib/%) IOLIB_OBJ := $(IOLIB_CO:%=build/%) $(IOLIB_SO:%=build/%) build/%.o: iolib/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: iolib/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< LIBCIO_C := atoi.c atol.c blkrd.c blkwr.c close.c clusmap.c conin.c conwr.c \ dirfns.c fgets.c filesys.c filname.c flread.c fopen.c fprintf.c \ fputs.c fread.c fscanf.c fseek.c fsinit.c fsize.c fstubs.c ftell.c \ fwrite.c getbuff.c getc.c getl.c getw.c lseek.c open.c posit.c putc.c \ putl.c putw.c read.c readrn.c rename.c scan.c setbuf.c ungetc.c \ unlink.c write.c writern.c LIBCIO_S := ptcl12.s LIBCIO_CO := $(LIBCIO_C:.c=.o) LIBCIO_SO := $(LIBCIO_S:.s=.o) LIBCIO_SRC := $(LIBCIO_C:%=libcio/%) $(LIBCIO_S:%=libcio/%) LIBCIO_OBJ := $(LIBCIO_CO:%=build/%) $(LIBCIO_SO:%=build/%) build/%.o: libcio/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: libcio/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< LIBSM_C := index.c memccpy.c memchr.c memcmp.c memcmpu.c memcpy.c memcpyw.c \ memset.c memsetw.c rindex.c str2lc.c str2uc.c strcat.c strccpy.c \ strchr.c strcmp.c strcpy.c strcspn.c strfill.c strlcmp.c strlen.c \ strltrm.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strrev.c \ strrevi.c strrtrm.c strspn.c strtok.c strtol.c LIBSM_CO := $(LIBSM_C:.c=.o) LIBSM_SRC := $(LIBSM_C:%=libsm/%) LIBSM_OBJ := $(LIBSM_CO:%=build/%) build/%.o: libsm/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< LIB700_C := bitrev.c ctype.c ispow2.c mangle.c micons.c tolower.c toupper.c LIB700_S := aldiv.s almul.s alrem.s blkfill.s blkmove.s finalone.s jumpto.s \ ldiv.s lmul.s lrem.s rand24.s setjmp.s uldiv.s LIB700_CO := $(LIB700_C:.c=.o) LIB700_SO := $(LIB700_S:.s=.o) LIB700_SRC := $(LIB700_C:%=lib700/%) $(LIB700_S:%=lib700/%) LIB700_OBJ := $(LIB700_CO:%=build/%) $(LIB700_SO:%=build/%) build/%.o: lib700/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: lib700/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< VLIB_C := cg2.c cg3.c glcinit.c lseg.c vbfill4.c vclrs.c vhinit.c vmput.c \ vobjfns.c vputs.c vputsv.c vsetpal.c vsinit.c vspray4.c vtext.c \ vwputm.c VLIB_S := acctrl.s glcplot.s tsplot4.s vbank.s vclrav.s vcputs.s vcputsv.s \ viint.s vputa.s vputc.s vputcv.s vputp.s vsetav.s vsetcv.s vsplot4.s \ vvputsv.s vwputp.s vwputs.s VLIB_CO := $(VLIB_C:.c=.o) VLIB_SO := $(VLIB_S:.s=.o) VLIB_SRC := $(VLIB_C:%=vlib/%) $(VLIB_S:%=vlib/%) VLIB_OBJ := $(VLIB_CO:%=build/%) $(VLIB_SO:%=build/%) build/%.o: vlib/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: vlib/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \ $(VLIB_OBJ) ROM_C := booter.c romp.c ROM_S := bios.s timeint.s ROM_CO := $(ROM_C:.c=.o) ROM_SO := $(ROM_S:.s=.o) ROM_SRC := $(ROM_C:%=rom/%) $(ROM_S:%=rom/%) ROM_OBJ := $(ROM_CO:%=build/%) $(ROM_SO:%=build/%) build/%.o: rom/%.c $(HEADERS) | build $(CROSS_GCC) $(FLAGS_COM) -c -o $@ $< build/%.o: rom/%.s $(HEADERS) | build $(CROSS_GCC) $(FLAGS_ASM) -c -o $@ $< all: $(PROLOG_OBJ) $(IOLIB_OBJ) $(LIBCIO_OBJ) $(LIBSM_OBJ) $(LIB700_OBJ) \ $(VLIB_OBJ) $(ROM_OBJ) build: mkdir build hatari/c.img: $(wildcard hatari/c/bin/*) $(wildcard hatari/c/work/*) rm -f hatari/c.img atari-hd-image 8 hatari/c.img BUCHLA hatari/c emu: hatari/c.img hatari \ --control-socket /tmp/buchla.sock \ --vdi-width 1280 --vdi-height 960 \ --drive-a false --drive-b false \ --acsi 0=hatari/c.img \ --harddrive hatari/d --gemdos-drive d rem: hatari/rem.py clean: rm -rf build rm -f hatari/c.img rm -f hatari/d/out/*