2 # Makefile for Virtual Jaguar core library
6 # This software is licensed under the GPL v3 or any later version. See the
7 # file GPLv3 for details. ;-)
10 # Cross compilation with MXE
11 #CROSS = i686-pc-mingw32-
13 # Figure out which system we're compiling for, and set the appropriate variables
16 OSTYPE := $(shell uname -a)
19 ifeq "$(findstring Msys,$(OSTYPE))" "Msys"
21 SYSTYPE := __GCCWIN32__
24 # Apple. Should catch both 'darwin' and 'darwin7.0'
25 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"
27 SYSTYPE := __GCCUNIX__ -D__THINK_STUPID__
28 SDLLIBTYPE := --static-libs
31 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux"
33 SYSTYPE := __GCCUNIX__
36 # ??? Throw error, unknown OS
39 $(error OS TYPE UNDETECTED)
43 SYSTYPE := __GCCWIN32__
47 # Set vars for libcdio
48 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
49 HAVECDIO := -DHAVE_LIB_CDIO
61 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
62 #CFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
63 #CXXFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
64 CFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
65 CXXFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
67 SDL_CFLAGS = `$(CROSS)sdl-config --cflags`
68 DEFINES = -D$(SYSTYPE)
105 # Targets for convenience sake, not "real" targets
108 all: obj obj/libjaguarcore.a
114 # Library rules (might not be cross-platform compatible)
115 obj/libjaguarcore.a: $(OBJS)
116 @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
118 # Main source compilation (implicit rules)...
121 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
122 # @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
123 @$(CC) $(GCC_DEPS) $(CFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@
126 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
127 # @$(CC) $(CXXFLAGS) $(INCS) -c $< -o $@
128 @$(CC) $(GCC_DEPS) $(CXXFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@