RetroArch/Makefile

191 lines
5.3 KiB
Makefile
Raw Normal View History

HAVE_FILE_LOGGER=1
2010-05-29 17:01:11 +02:00
include config.mk
2010-05-28 14:04:50 +02:00
TARGET = retroarch
JTARGET = tools/retroarch-joyconfig
2010-05-26 21:27:37 +02:00
OBJDIR := obj-unix
2014-09-14 00:11:08 +02:00
ifeq ($(GLOBAL_CONFIG_DIR),)
GLOBAL_CONFIG_DIR = /etc
endif
OBJ :=
2014-09-14 01:58:57 +02:00
JOYCONFIG_OBJ :=
2014-09-14 00:11:08 +02:00
LIBS :=
2014-09-24 09:39:41 +02:00
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
2014-09-14 00:11:08 +02:00
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
2012-06-20 00:43:41 +02:00
ifneq ($(findstring Win32,$(OS)),)
LDFLAGS += -static-libgcc
endif
include Makefile.common
2014-01-11 19:08:24 +01:00
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
2010-11-19 21:26:31 +01:00
2011-05-11 17:52:16 +02:00
ifeq ($(HAVE_DYLIB), 1)
LIBS += $(DYLIB_LIB)
2010-05-29 16:59:57 +02:00
endif
2010-05-28 14:04:50 +02:00
ifeq ($(HAVE_DYNAMIC), 1)
LIBS += $(DYLIB_LIB)
else
2012-04-22 10:46:06 +02:00
LIBS += $(libretro)
2010-12-30 13:54:49 +01:00
endif
2011-01-10 17:15:27 +01:00
ifneq ($(V),1)
Q := @
endif
2011-10-07 17:43:39 +02:00
ifeq ($(DEBUG), 1)
2015-06-05 18:22:44 -03:00
OPTIMIZE_FLAG = -O0 -g
else
OPTIMIZE_FLAG = -O3 -ffast-math
2011-10-07 17:43:39 +02:00
endif
2015-04-20 00:38:55 +02:00
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
CXXFLAGS := $(CFLAGS) -std=c++0x -D__STDC_CONSTANT_MACROS
2015-04-20 00:38:55 +02:00
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
2014-08-29 16:35:56 -03:00
2011-12-24 13:46:12 +01:00
ifeq ($(CXX_BUILD), 1)
2014-06-15 21:45:25 +02:00
LINK = $(CXX)
CFLAGS := $(CXXFLAGS) -xc++
2011-12-24 13:46:12 +01:00
else
2014-08-29 16:35:56 -03:00
ifeq ($(findstring Win32,$(OS)),)
LINK = $(CC)
else
# directx-related code is c++
LINK = $(CXX)
endif
ifneq ($(GNU90_BUILD), 1)
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
else
CFLAGS += -std=gnu99 -D_GNU_SOURCE
endif
endif
ifneq ($(C89_BUILD)$(C90_BUILD),)
#looks kinda ugly, but it makes both C89_BUILD and C90_BUILD work and refer to the same thing
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic
endif
2011-12-24 13:46:12 +01:00
endif
2010-05-26 21:27:37 +02:00
ifeq ($(NOUNUSED), yes)
CFLAGS += -Wno-unused-result
CXXFLAGS += -Wno-unused-result
endif
2013-03-16 12:24:53 +01:00
ifeq ($(NOUNUSED_VARIABLE), yes)
CFLAGS += -Wno-unused-variable
CXXFLAGS += -Wno-unused-variable
2013-03-16 12:24:53 +01:00
endif
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
RARCH_JOYCONFIG_OBJ := $(addprefix $(OBJDIR)/,$(JOYCONFIG_OBJ))
2015-05-19 15:11:34 -03:00
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDLAGS)
endif
all: $(TARGET) $(JTARGET) config.mk
2010-12-30 02:56:56 +01:00
2014-10-16 07:34:59 +02:00
-include $(RARCH_OBJ:.o=.d) $(RARCH_JOYCONFIG_OBJ:.o=.d)
2010-12-30 02:56:56 +01:00
config.mk: configure qb/*
@echo "config.mk is outdated or non-existing. Run ./configure again."
2010-12-30 03:23:12 +01:00
@exit 1
2010-05-28 14:04:50 +02:00
retroarch: $(RARCH_OBJ)
2011-01-10 17:15:27 +01:00
@$(if $(Q), $(shell echo echo LD $@),)
2014-06-15 21:45:25 +02:00
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
2010-06-27 15:46:23 +02:00
$(JTARGET): $(RARCH_JOYCONFIG_OBJ)
2013-01-04 21:56:15 +01:00
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LINK) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(OBJDIR)/%.o: %.c config.h config.mk
@mkdir -p $(dir $@)
2011-01-10 17:15:27 +01:00
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
2010-05-28 14:04:50 +02:00
2014-08-29 16:35:56 -03:00
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
2014-08-29 16:35:56 -03:00
2015-04-20 00:38:55 +02:00
$(OBJDIR)/%.o: %.m
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo OBJC $<),)
2015-04-20 00:38:55 +02:00
$(Q)$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $<
.FORCE:
$(OBJDIR)/git_version.o: git_version.c .FORCE
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
2014-10-04 04:18:36 +01:00
$(OBJDIR)/tools/parport_joypad.o: input/parport_joypad.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c
@mkdir -p $(dir $@)
2013-09-25 19:32:18 +02:00
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
2013-09-25 19:32:18 +02:00
$(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
@mkdir -p $(dir $@)
2012-12-09 18:37:09 +01:00
@$(if $(Q), $(shell echo echo AS $<),)
2013-01-04 21:56:15 +01:00
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
2012-12-09 17:28:49 +02:00
2014-09-14 17:50:29 -03:00
$(OBJDIR)/%.o: %.rc $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo WINDRES $<),)
$(Q)$(WINDRES) -o $@ $<
2010-05-28 14:04:50 +02:00
install: $(TARGET)
rm -f $(OBJDIR)/git_version.o
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
2013-10-07 22:09:05 +02:00
install -m755 tools/cg2glsl.py $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
install -m755 $(JTARGET) $(DESTDIR)$(PREFIX)/bin
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
install -m644 docs/retroarch-cg2glsl.1 $(DESTDIR)$(MAN_DIR)
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(MAN_DIR)
install -m644 media/retroarch.png $(DESTDIR)$(PREFIX)/share/pixmaps
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
2010-05-28 14:04:50 +02:00
uninstall:
2012-04-21 23:31:57 +02:00
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
2013-10-07 22:09:05 +02:00
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
2012-04-21 23:31:57 +02:00
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch.1
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-cg2glsl.1
2012-04-21 23:31:57 +02:00
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-joyconfig.1
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.png
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
2010-05-26 21:27:37 +02:00
clean:
rm -rf $(OBJDIR)
2010-08-19 20:29:32 +02:00
rm -f $(TARGET)
rm -f $(JTARGET)
rm -f *.d
2010-06-27 15:46:23 +02:00
.PHONY: all install uninstall clean