--- hatari/src/uae-cpu/Makefile 2019/04/01 07:10:40 1.1.1.3 +++ hatari/src/uae-cpu/Makefile 2019/04/01 07:13:12 1.1.1.7 @@ -1,35 +1,52 @@ +# Makefile for Hatari's UAE CPU. -# Set flags passed to the compiler (e.g. optimization flags) -CMPLRFLAGS = -g -O2 -Wall -Wno-unused +# Include settings +include ../../Makefile.cnf -# SDL-Library configuration: -SDLLIB = $(shell sdl-config --libs) -SDLFLAGS = $(shell sdl-config --cflags) - -CFLAGS = -I. $(CMPLRFLAGS) $(SDLFLAGS) +CFLAGS += -I. $(SDL_CFLAGS) +# disable several warnings for the CPU emu code as it comes from elsewhere +QUIETCFLAGS = $(CFLAGS) -Wno-unused -Wno-sign-compare -Wno-shadow CPUCSRCS = hatari-glue.c memory.c newcpu.c readcpu.c fpp.c cpustbl.c cpudefs.c -#CPUEMUSRCS = cpufast1.s cpufast2.s cpufast3.s cpufast4.s \ -# cpufast5.s cpufast6.s cpufast7.s cpufast8.s CPUEMUSRCS = cpuemu1.c cpuemu2.c cpuemu3.c cpuemu4.c \ - cpuemu5.c cpuemu6.c cpuemu7.c cpuemu8.c + cpuemu5.c cpuemu6.c cpuemu7.c cpuemu8.c CPU_OBS = $(CPUCSRCS:.c=.o) $(CPUEMUSRCS:.c=.o) -all: cpudefs.c cpuemu.c $(CPU_OBS) +all: $(CPU_OBS) -clean: - rm -f *.o gencpu build68k cpuopti cpudefs.c cpustbl.c cputbl.h cpuemu.c -cpudefs.c: ./build68k ./table68k - ./build68k <./table68k >cpudefs.c +build68k: build68k.c + $(HOSTCC) $(HOSTCFLAGS) -o $@ $< + +# Hack for compiling with MinGW (it does not like the "./" before build68k): +ifeq ($(SHELL),sh.exe) + +cpudefs.c: build68k table68k + build68k cpudefs.c + +else + +cpudefs.c: build68k table68k + ./build68k cpudefs.c + +endif -gencpu: gencpu.o readcpu.o cpudefs.o - $(CC) $(LDFLAGS) -o gencpu gencpu.o readcpu.o cpudefs.o +cpudefs-host.o: cpudefs.c + $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< + +readcpu-host.o: readcpu.c + $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< + +gencpu.o: gencpu.c + $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< + +gencpu: gencpu.o readcpu-host.o cpudefs-host.o + $(HOSTCC) $(HOSTLDFLAGS) -o $@ $^ cpuemu.c: gencpu ./gencpu @@ -38,61 +55,31 @@ cpustbl.c: cpuemu.c cputbl.h: cpuemu.c -cpuopti: cpuopti.o - $(CC) $(LDFLAGS) -o cpuopti cpuopti.o - - -# sam: this is for people with low memory. (is there a way do do this with a single rule ?) +# this is for people with low memory (is there a way do do this with a single rule ?) cpuemu1.o: cpuemu.c - $(CC) -DPART_1 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_1 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu2.o: cpuemu.c - $(CC) -DPART_2 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_2 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu3.o: cpuemu.c - $(CC) -DPART_3 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_3 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu4.o: cpuemu.c - $(CC) -DPART_4 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_4 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu5.o: cpuemu.c - $(CC) -DPART_5 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_5 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu6.o: cpuemu.c - $(CC) -DPART_6 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_6 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu7.o: cpuemu.c - $(CC) -DPART_7 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_7 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ cpuemu8.o: cpuemu.c - $(CC) -DPART_8 $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $< -o $@ + $(CC) -DPART_8 -c $(CPPFLAGS) $(QUIETCFLAGS) $< -o $@ + +newcpu.o: sysdeps.h hatari-glue.h maccess.h memory.h newcpu.h -cpufast1.s: cpuemu.c cpuopti - $(CC) -DPART_1 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp1.s - ./cpuopti $@ - rm cputmp1.s -cpufast2.s: cpuemu.c cpuopti - $(CC) -DPART_2 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp2.s - ./cpuopti $@ - rm cputmp2.s -cpufast3.s: cpuemu.c cpuopti - $(CC) -DPART_3 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp3.s - ./cpuopti $@ - rm cputmp3.s -cpufast4.s: cpuemu.c cpuopti - $(CC) -DPART_4 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp4.s - ./cpuopti $@ - rm cputmp4.s -cpufast5.s: cpuemu.c cpuopti - $(CC) -DPART_5 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp5.s - ./cpuopti $@ - rm cputmp5.s -cpufast6.s: cpuemu.c cpuopti - $(CC) -DPART_6 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp6.s - ./cpuopti $@ - rm cputmp6.s -cpufast7.s: cpuemu.c cpuopti - $(CC) -DPART_7 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp7.s - ./cpuopti $@ - rm cputmp7.s -cpufast8.s: cpuemu.c cpuopti - $(CC) -DPART_8 $(INCLUDES) -S $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(NO_SCHED_CFLAGS) $< -o cputmp8.s - ./cpuopti $@ - rm cputmp8.s +clean: + $(RM) *.o gencpu build68k -newcpu.o: sysdeps.h hatari-glue.h maccess.h memory.h newcpu.h compiler.h events.h +distclean: clean + $(RM) cpudefs.c cpustbl.c cputbl.h cpuemu.c + $(RM) *~ *.bak *.orig