]> Shamusworld >> Repos - virtualjaguar/blob - src/m68000/Makefile
2.0.2 release.
[virtualjaguar] / src / m68000 / Makefile
1 #
2 # Makefile for modified UAE 68000 CPU core
3 #
4 # by James Hammons
5 # (C) 2011 Underground Software
6 #
7 # This makefile is released under the GPLv3 or later
8 #
9
10 CC      := gcc
11 LD      := gcc
12 AR      := ar
13 ARFLAGS := -rs
14
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
18 INCS    := -I. -I./obj `sdl-config --cflags`
19
20 OBJS = \
21         obj/cpustbl.o \
22         obj/cpudefs.o \
23         obj/cpuemu.o \
24         obj/cpuextra.o \
25         obj/readcpu.o \
26         obj/m68kinterface.o \
27         obj/m68kdasm.o
28
29 #       obj/newcpu.o \
30
31 # Targets for convenience sake, not "real" targets
32 .PHONY: clean
33
34 all: obj obj/libm68k.a
35         @echo "Done!"
36
37 # Library rules (might not be cross-platform compatible)
38 obj/libm68k.a: $(OBJS) 
39         @$(AR) $(ARFLAGS) obj/libm68k.a $(OBJS)
40
41 obj:
42         @mkdir ./obj
43
44 # Main source compilation (implicit rules)...
45
46 obj/%.o: %.c
47         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
48         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
49
50 obj/%.o: obj/%.c
51         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
52         @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
53
54 # Generated code
55
56 obj/cpuemu.c: obj/gencpu
57 obj/cpustbl.c: obj/gencpu
58         @echo -e "\033[01;33m***\033[00;32m Generating cpuemu.c...\033[00m"
59         @cd obj && ./gencpu
60
61 obj/gencpu: obj/cpudefs.c
62         @echo -e "\033[01;33m***\033[00;32m Generating gencpu...\033[00m"
63         @$(CC) $(CFLAGS) gencpu.c readcpu.c obj/cpudefs.c -o obj/gencpu -I. -I./obj
64
65 obj/cpudefs.c: obj/build68k
66         @echo -e "\033[01;33m***\033[00;32m Generating cpudefs.c...\033[00m"
67         @obj/build68k < table68k > obj/cpudefs.c
68
69 obj/build68k: build68k.c
70         @echo -e "\033[01;33m***\033[00;32m Compiling build68k.c...\033[00m"
71         @$(CC) $(CFLAGS) build68k.c -o obj/build68k
72
73 clean:
74         @echo -ne "\033[01;33m***\033[00;32m Cleaning out the garbage...\033[00m"
75         @-rm -rf ./obj
76 #       @-$(FIND) . -name "*~" -exec rm -f {} \;
77         @echo "done!"
78
79 # Pull in dependencies autogenerated by gcc's -MMD switch
80 # The "-" in front is there just in case they haven't been created yet
81
82 -include obj/*.d