2 # Makefile for modified UAE 68000 CPU core
5 # (C) 2011 Underground Software
7 # This makefile is released under the GPLv3 or later
15 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
16 #CFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer -g
17 CFLAGS ?= -O2 -ffast-math -fomit-frame-pointer -g
20 INCS := -I. -I./obj `sdl-config --cflags`
31 # Targets for convenience sake, not "real" targets
34 all: obj obj/libm68k.a
37 # Library rules (might not be cross-platform compatible)
38 obj/libm68k.a: $(OBJS)
39 @$(AR) $(ARFLAGS) obj/libm68k.a $(OBJS)
44 # Main source compilation (implicit rules)...
47 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
48 # @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
49 @$(CC) $(GCC_DEPS) $(CFLAGS) $(INCS) -c $< -o $@
52 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
53 # @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
54 @$(CC) $(GCC_DEPS) $(CFLAGS) $(INCS) -c $< -o $@
58 obj/cpuemu.c: obj/gencpu
59 obj/cpustbl.c: obj/gencpu
60 @echo -e "\033[01;33m***\033[00;32m Generating cpuemu.c...\033[00m"
63 obj/gencpu: obj/cpudefs.c
64 @echo -e "\033[01;33m***\033[00;32m Generating gencpu...\033[00m"
65 # @$(CC) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
66 @$(CC) $(GCC_DEPS) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
68 obj/cpudefs.c: obj/build68k
69 @echo -e "\033[01;33m***\033[00;32m Generating cpudefs.c...\033[00m"
70 @obj/build68k < table68k > obj/cpudefs.c
72 obj/build68k: build68k.c
73 @echo -e "\033[01;33m***\033[00;32m Compiling build68k.c...\033[00m"
74 # @$(CC) $(CFLAGS) build68k.c -o obj/build68k
75 @$(CC) $(GCC_DEPS) $(CFLAGS) build68k.c -o obj/build68k
78 @echo -ne "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
80 # @-$(FIND) . -name "*~" -exec rm -f {} \;
83 # Pull in dependencies autogenerated by gcc's -MMD switch
84 # The "-" in front is there just in case they haven't been created yet