]> Shamusworld >> Repos - virtualjaguar/blob - jaguarcore.mak
Fixed updated joystick handling, first major stab at gamepad profiles.
[virtualjaguar] / jaguarcore.mak
1 #
2 # Makefile for Virtual Jaguar core library
3 #
4 # by James Hammons
5 #
6 # This software is licensed under the GPL v3 or any later version. See the
7 # file GPLv3 for details. ;-)
8 #
9
10 # Cross compilation with MXE
11 #CROSS = i686-pc-mingw32-
12
13 # Figure out which system we're compiling for, and set the appropriate variables
14
15 ifeq "$(CROSS)" ""
16 OSTYPE := $(shell uname -a)
17
18 # Win32
19 ifeq "$(findstring Msys,$(OSTYPE))" "Msys"
20
21 SYSTYPE    := __GCCWIN32__
22 SDLLIBTYPE := --libs
23
24 # Apple. Should catch both 'darwin' and 'darwin7.0'
25 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"
26
27 SYSTYPE    := __GCCUNIX__ -D__THINK_STUPID__
28 SDLLIBTYPE := --static-libs
29
30 # Linux
31 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux"
32
33 SYSTYPE    := __GCCUNIX__
34 SDLLIBTYPE := --libs
35
36 # ??? Throw error, unknown OS
37 else
38
39 $(error OS TYPE UNDETECTED)
40
41 endif
42 else
43 SYSTYPE    := __GCCWIN32__
44 SDLLIBTYPE := --libs
45 endif
46
47 # Set vars for libcdio
48 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
49 HAVECDIO := -DHAVE_LIB_CDIO
50 CDIOLIB  := -lcdio
51 else
52 HAVECDIO :=
53 CDIOLIB  :=
54 endif
55
56 CC      := $(CROSS)gcc
57 LD      := $(CROSS)gcc
58 AR      := $(CROSS)ar
59 ARFLAGS := -rs
60
61 SDL_CFLAGS = `$(CROSS)sdl-config --cflags`
62 DEFINES = -D$(SYSTYPE)
63 GCC_DEPS = -MMD
64
65 INCS := -I./src
66
67 OBJS := \
68         obj/blitter.o      \
69         obj/cdintf.o       \
70         obj/cdrom.o        \
71         obj/crc32.o        \
72         obj/dac.o          \
73         obj/dsp.o          \
74         obj/eeprom.o       \
75         obj/event.o        \
76         obj/file.o         \
77         obj/filedb.o       \
78         obj/gpu.o          \
79         obj/jagbios.o      \
80         obj/jagbios2.o     \
81         obj/jagcdbios.o    \
82         obj/jagdevcdbios.o \
83         obj/jagstub1bios.o \
84         obj/jagstub2bios.o \
85         obj/jagdasm.o      \
86         obj/jaguar.o       \
87         obj/jerry.o        \
88         obj/joystick.o     \
89         obj/log.o          \
90         obj/memory.o       \
91         obj/mmu.o          \
92         obj/op.o           \
93         obj/settings.o     \
94         obj/state.o        \
95         obj/tom.o          \
96         obj/universalhdr.o \
97         obj/unzip.o        \
98         obj/wavetable.o
99
100 # Targets for convenience sake, not "real" targets
101 .PHONY: clean
102
103 all: obj obj/libjaguarcore.a
104         @echo "Done!"
105
106 obj:
107         @mkdir obj
108
109 # Library rules (might not be cross-platform compatible)
110 obj/libjaguarcore.a: $(OBJS) 
111         @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
112
113 # Main source compilation (implicit rules)...
114
115 obj/%.o: src/%.cpp
116         @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
117         @$(CC) $(GCC_DEPS) $(CXXFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@
118
119 -include obj/*.d