--- hatari/src/Makefile 2019/04/01 07:10:11 1.1.1.5 +++ hatari/src/Makefile 2019/04/09 08:47:54 1.1.1.16 @@ -1,64 +1,95 @@ -# Makefile for Hatari +# Main Makefile for Hatari. -# Set the C compiler (e.g. gcc) -CC = gcc +# Use "export ENABLE_DSP_EMU=0" & "make clean" +# to disable experimental DSP emulation code. +ENABLE_DSP_EMU ?= 1 -# Set flags passed to the compiler (e.g. optimization flags) -CMPLRFLAGS = -O3 -fomit-frame-pointer -Wall -Wno-unused +# Select CPU directory: +CPUDIR = uae-cpu -# Here you can define the default data directory for Hatari where it -# looks for the default TOS image etc. -# For example you can use the local directory with . or if you want to do -# a system-wide installation, use something like /usr/share/hatari -DATADIR = . - -# SDL-Library configuration: -SDLLIB = $(shell sdl-config --libs) -SDLFLAGS = $(shell sdl-config --cflags) +# Include settings +include ../Makefile.cnf # Additional include directories: -INCFLAGS = -I./includes -I./uae-cpu +CPPFLAGS += -I.. -I./includes -I$(CPUDIR) -I./falcon +CPPFLAGS += -DCONFDIR=\"$(CONFDIR)\" $(SDL_CFLAGS) - -CFLAGS = $(CMPLRFLAGS) $(INCFLAGS) $(SDLFLAGS) - - -CPUOBJS = ./uae-cpu/hatari-glue.o ./uae-cpu/memory.o ./uae-cpu/newcpu.o \ - ./uae-cpu/readcpu.o ./uae-cpu/fpp.o ./uae-cpu/cpustbl.o ./uae-cpu/cpudefs.o \ - ./uae-cpu/cpuemu1.o ./uae-cpu/cpuemu2.o ./uae-cpu/cpuemu3.o \ - ./uae-cpu/cpuemu4.o ./uae-cpu/cpuemu5.o ./uae-cpu/cpuemu6.o \ - ./uae-cpu/cpuemu7.o ./uae-cpu/cpuemu8.o - -SRCS = audio.c bios.c blitter.c cart.c configuration.c createBlankImage.c \ - createDiscImage.c debug.c debugui.c dialog.c errlog.c fdc.c file.c \ - floppy.c gemdos.c hdc.c ikbd.c int.c intercept.c joy.c keymap.c m68000.c \ - main.c midi.c memAlloc.c memorySnapShot.c mfp.c misc.c msa.c psg.c \ - printer.c rs232.c reset.c st.c stMemory.c screen.c screenConvert.c \ - screenSnapShot.c sdlgui.c shortcut.c sound.c spec512.c \ - tos.c vdi.c video.c wavFormat.c xbios.c ymFormat.c +ifeq ($(ENABLE_DSP_EMU),1) +CPPFLAGS += -DENABLE_DSP_EMU=1 +endif + +SRCS = audio.c bios.c blitter.c breakcond.c cart.c cfgopts.c \ + configuration.c options.c createBlankImage.c change.c control.c \ + cycles.c debugui.c dialog.c dim.c dmaSnd.c fdc.c file.c floppy.c \ + gemdos.c hdc.c ide.c ikbd.c int.c ioMem.c ioMemTabST.c ioMemTabSTE.c \ + ioMemTabTT.c ioMemTabFalcon.c joy.c keymap.c log.c m68000.c main.c \ + midi.c memorySnapShot.c mfp.c msa.c paths.c psg.c printer.c rs232.c \ + reset.c rtc.c scandir.c st.c stMemory.c screen.c screenSnapShot.c \ + shortcut.c sound.c spec512.c statusbar.c str.c tos.c unzip.c utils.c \ + vdi.c video.c wavFormat.c xbios.c ymFormat.c zip.c OBJS = $(SRCS:.c=.o) +SUBDIRLIBS = $(CPUDIR)/cpu68k.a falcon/falcon.a gui-sdl/gui-sdl.a -hatari: $(OBJS) cpu - $(CC) $(OBJS) $(CPUOBJS) $(SDLLIB) -o hatari - strip hatari +ifeq ($(SYS_WINDOWS),1) + SUBDIRLIBS += gui-win/gui-win.a + OBJS += gui-win/hatari-winicon.o +else +ifneq ($(strip $(shell gcc -v 2>&1 |grep "cygwin")),) + SUBDIRLIBS += gui-win/gui-win.a +endif +endif + +SUBDIRS = $(dir $(SUBDIRLIBS)) +ALLOBJS = $(OBJS) $(SUBDIRLIBS) + + +.PHONY : all +all: ../Makefile.cnf + $(MAKE) $(SUBDIRS) + $(MAKE) hatari + +hatari: $(ALLOBJS) + $(CC) $(LDFLAGS) $(ALLOBJS) $(SDL_LIBS) $(LIBS) -o hatari + +# Sub-folder dependencies: +.PHONY : $(SUBDIRS) +$(SUBDIRS): + $(MAKE) ENABLE_DSP_EMU=$(ENABLE_DSP_EMU) CPUDIR=$(CPUDIR) -C $@ -cpu: - $(MAKE) -C uae-cpu/ CC="$(CC)" CMPLRFLAGS="$(CMPLRFLAGS)" SDLFLAGS="$(SDLFLAGS)" all clean: - rm -f *.o hatari - $(MAKE) -C uae-cpu/ clean - - -configuration.o: configuration.c - $(CC) $(CFLAGS) -c -DDATADIR=\"$(DATADIR)\" configuration.c -o configuration.o - -sdlgui.o: sdlgui.c - $(CC) $(CFLAGS) -c -DDATADIR=\"$(DATADIR)\" sdlgui.c -o sdlgui.o + $(RM) *.o hatari + $(MAKE) -C gui-sdl/ clean + $(MAKE) -C gui-win/ clean + $(MAKE) -C $(CPUDIR) clean + $(MAKE) -C falcon/ clean + +distclean: + $(RM) *.o hatari + $(RM) Makefile.dep *~ *.bak *.orig + $(RM) convert/*~ convert/*.bak + $(MAKE) -C gui-sdl/ distclean + $(MAKE) -C gui-win/ distclean + $(MAKE) -C $(CPUDIR) distclean + $(MAKE) -C falcon/ distclean + + +# Use "make depend" to generate file dependencies: +Makefile.dep: Makefile ../Makefile.cnf + $(CC) -M $(CPPFLAGS) $(SRCS) > Makefile.dep + +.PHONY : depend +depend: + $(MAKE) cleandeps + $(MAKE) Makefile.dep + $(MAKE) -C gui-sdl/ depend + $(MAKE) -C $(CPUDIR) depend + $(MAKE) -C falcon/ depend + +.PHONY : cleandeps +cleandeps: + $(RM) Makefile.dep */Makefile.dep -screenConvert.o: convert/high640x1.c convert/low640x16.c convert/spec320x16.c \ - convert/vdi4.c convert/high640x8.c convert/low640x8.c convert/spec640x16.c \ - convert/low320x16.c convert/med640x16.c convert/vdi16.c \ - convert/low320x8.c convert/med640x8.c convert/vdi2.c +-include Makefile.dep