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 # Figure out which system we're compiling for, and set the appropriate variables
12 OSTYPE := $(shell uname -a)
15 ifeq "$(findstring Msys,$(OSTYPE))" "Msys"
17 SYSTYPE := __GCCWIN32__
20 # Apple. Should catch both 'darwin' and 'darwin7.0'
21 else ifeq "$(findstring Darwin,$(OSTYPE))" "Darwin"
23 SYSTYPE := __GCCUNIX__ -D__THINK_STUPID__
24 SDLLIBTYPE := --static-libs
27 else ifeq "$(findstring Linux,$(OSTYPE))" "Linux"
29 SYSTYPE := __GCCUNIX__
32 # ??? Throw error, unknown OS
35 $(error OS TYPE UNDETECTED)
39 # Set vars for libcdio
40 ifneq "$(shell pkg-config --silence-errors --libs libcdio)" ""
41 HAVECDIO := -DHAVE_LIB_CDIO
53 # Note that we use optimization level 2 instead of 3--3 doesn't seem to gain much over 2
54 #CFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
55 #CXXFLAGS := -MMD -O2 -ffast-math -fomit-frame-pointer `sdl-config --cflags` -D$(SYSTYPE)
56 CFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
57 CXXFLAGS ?= -O2 -ffast-math -fomit-frame-pointer
59 SDL_CFLAGS = `sdl-config --cflags`
60 DEFINES = -D$(SYSTYPE)
97 # Targets for convenience sake, not "real" targets
100 all: obj obj/libjaguarcore.a
106 # Library rules (might not be cross-platform compatible)
107 obj/libjaguarcore.a: $(OBJS)
108 @$(AR) $(ARFLAGS) obj/libjaguarcore.a $(OBJS)
110 # Main source compilation (implicit rules)...
113 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
114 # @$(CC) $(CFLAGS) $(INCS) -c $< -o $@
115 @$(CC) $(GCC_DEPS) $(CFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@
118 @echo -e "\033[01;33m***\033[00;32m Compiling $<...\033[00m"
119 # @$(CC) $(CXXFLAGS) $(INCS) -c $< -o $@
120 @$(CC) $(GCC_DEPS) $(CXXFLAGS) $(SDL_CFLAGS) $(DEFINES) $(INCS) -c $< -o $@