2015-06-12 12:31:28 -03:00
|
|
|
HAVE_FILE_LOGGER=1
|
2016-06-26 21:26:21 +02:00
|
|
|
NEED_CXX_LINKER=0
|
2015-09-06 15:12:32 +02:00
|
|
|
MISSING_DECLS =0
|
2015-06-12 12:31:28 -03:00
|
|
|
|
2015-09-22 13:08:46 +02:00
|
|
|
ifneq ($(C90_BUILD),)
|
|
|
|
C89_BUILD=1
|
|
|
|
endif
|
|
|
|
|
2010-05-29 17:01:11 +02:00
|
|
|
include config.mk
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2014-10-16 07:36:06 +02:00
|
|
|
TARGET = retroarch
|
2010-05-26 21:27:37 +02:00
|
|
|
|
2014-02-02 15:29:07 +01:00
|
|
|
OBJDIR := obj-unix
|
|
|
|
|
2014-09-14 00:11:08 +02:00
|
|
|
ifeq ($(GLOBAL_CONFIG_DIR),)
|
|
|
|
GLOBAL_CONFIG_DIR = /etc
|
|
|
|
endif
|
|
|
|
|
2014-09-14 00:04:42 +02:00
|
|
|
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
|
|
|
|
2014-09-15 22:15:00 -03:00
|
|
|
ifneq ($(findstring Win32,$(OS)),)
|
|
|
|
LDFLAGS += -static-libgcc
|
|
|
|
endif
|
|
|
|
|
2014-09-14 00:04:42 +02:00
|
|
|
include Makefile.common
|
2014-06-07 21:18:58 +02:00
|
|
|
|
2015-09-05 16:48:11 +02:00
|
|
|
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
|
|
|
|
DEFINES += -Wno-invalid-source-encoding
|
|
|
|
endif
|
|
|
|
|
2016-10-02 08:31:19 -07:00
|
|
|
ifeq ($(shell $(CC) -v 2>&1 | grep -c "tcc"),1)
|
|
|
|
MD = -MD
|
|
|
|
else
|
|
|
|
MD = -MMD
|
|
|
|
endif
|
|
|
|
|
2014-01-11 19:08:24 +01:00
|
|
|
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
2010-11-19 21:26:31 +01:00
|
|
|
|
2015-09-06 14:45:24 +02:00
|
|
|
ifeq ($(MISSING_DECLS), 1)
|
2016-07-15 15:40:06 +02:00
|
|
|
DEFINES += -Werror=missing-declarations
|
2015-09-06 14:45:24 +02:00
|
|
|
endif
|
|
|
|
|
2011-05-11 17:52:16 +02:00
|
|
|
ifeq ($(HAVE_DYLIB), 1)
|
2011-06-16 22:47:37 +02:00
|
|
|
LIBS += $(DYLIB_LIB)
|
2010-05-29 16:59:57 +02:00
|
|
|
endif
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2010-12-30 14:26:12 +01:00
|
|
|
ifeq ($(HAVE_DYNAMIC), 1)
|
2011-06-16 22:47:37 +02:00
|
|
|
LIBS += $(DYLIB_LIB)
|
2010-12-30 14:26:12 +01:00
|
|
|
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
|
|
|
|
|
2016-10-08 15:33:29 -05:00
|
|
|
ifneq ($(findstring Win32,$(OS)),)
|
|
|
|
LDFLAGS += -mwindows
|
|
|
|
endif
|
|
|
|
|
2015-04-20 00:38:55 +02:00
|
|
|
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
2016-02-16 20:24:00 +01:00
|
|
|
|
|
|
|
APPEND_CFLAGS := $(CFLAGS)
|
|
|
|
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -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)
|
2016-04-27 22:54:33 +02:00
|
|
|
CFLAGS := $(CXXFLAGS) -xc++
|
2016-07-15 15:40:06 +02:00
|
|
|
CFLAGS += -DCXX_BUILD
|
|
|
|
CXXFLAGS += -DCXX_BUILD
|
2011-12-24 13:46:12 +01:00
|
|
|
else
|
2016-07-15 15:40:06 +02:00
|
|
|
ifeq ($(NEED_CXX_LINKER),1)
|
|
|
|
LINK = $(CXX)
|
|
|
|
else ifeq ($(findstring Win32,$(OS)),)
|
2014-08-29 16:35:56 -03:00
|
|
|
LINK = $(CC)
|
|
|
|
else
|
|
|
|
# directx-related code is c++
|
|
|
|
LINK = $(CXX)
|
|
|
|
endif
|
|
|
|
|
2013-10-22 21:41:51 +02:00
|
|
|
ifneq ($(GNU90_BUILD), 1)
|
|
|
|
ifneq ($(findstring icc,$(CC)),)
|
|
|
|
CFLAGS += -std=c99 -D_GNU_SOURCE
|
|
|
|
else
|
2014-06-08 12:37:32 +02:00
|
|
|
CFLAGS += -std=gnu99 -D_GNU_SOURCE
|
2013-10-22 21:41:51 +02:00
|
|
|
endif
|
2012-09-18 12:16:27 +02:00
|
|
|
endif
|
2015-06-26 15:43:45 +02:00
|
|
|
|
2015-09-22 13:08:46 +02:00
|
|
|
ifneq ($(C89_BUILD),)
|
2015-09-22 13:32:56 +02:00
|
|
|
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
2015-06-26 15:43:45 +02:00
|
|
|
endif
|
2011-12-24 13:46:12 +01:00
|
|
|
endif
|
2010-05-26 21:27:37 +02:00
|
|
|
|
2012-05-01 23:00:37 +02:00
|
|
|
ifeq ($(NOUNUSED), yes)
|
|
|
|
CFLAGS += -Wno-unused-result
|
2014-09-15 12:19:56 -03:00
|
|
|
CXXFLAGS += -Wno-unused-result
|
2012-05-01 23:00:37 +02:00
|
|
|
endif
|
2013-03-16 12:24:53 +01:00
|
|
|
ifeq ($(NOUNUSED_VARIABLE), yes)
|
|
|
|
CFLAGS += -Wno-unused-variable
|
2014-09-15 12:19:56 -03:00
|
|
|
CXXFLAGS += -Wno-unused-variable
|
2013-03-16 12:24:53 +01:00
|
|
|
endif
|
2012-05-01 23:00:37 +02:00
|
|
|
|
2014-02-02 15:29:07 +01:00
|
|
|
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
2013-04-26 00:43:14 +02:00
|
|
|
|
2015-05-19 15:11:34 -03:00
|
|
|
ifneq ($(SANITIZER),)
|
|
|
|
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
|
|
|
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
2016-08-30 14:40:52 -04:00
|
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
2015-05-19 15:11:34 -03:00
|
|
|
endif
|
|
|
|
|
2015-11-24 13:49:36 -03:00
|
|
|
ifneq ($(findstring $(GPERFTOOLS),profiler),)
|
|
|
|
LIBS += -lprofiler
|
|
|
|
endif
|
|
|
|
ifneq ($(findstring $(GPERFTOOLS),tcmalloc),)
|
|
|
|
LIBS += -ltcmalloc
|
|
|
|
endif
|
|
|
|
|
2015-11-11 20:18:45 +01:00
|
|
|
all: $(TARGET) config.mk
|
2010-12-30 02:56:56 +01:00
|
|
|
|
2016-07-15 15:42:26 +02:00
|
|
|
ifeq ($(MAKECMDGOALS),clean)
|
|
|
|
config.mk:
|
|
|
|
else
|
2015-11-11 20:15:27 +01:00
|
|
|
-include $(RARCH_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
|
2016-07-15 15:42:26 +02:00
|
|
|
endif
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2014-02-02 15:29:07 +01:00
|
|
|
retroarch: $(RARCH_OBJ)
|
2011-01-10 17:15:27 +01:00
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2016-09-08 18:23:26 +02:00
|
|
|
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2010-06-27 15:46:23 +02:00
|
|
|
|
2014-03-27 22:19:06 +01:00
|
|
|
$(OBJDIR)/%.o: %.c config.h config.mk
|
2014-02-02 15:29:07 +01:00
|
|
|
@mkdir -p $(dir $@)
|
2011-01-10 17:15:27 +01:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2016-10-02 08:31:19 -07:00
|
|
|
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(MD) -c -o $@ $<
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2016-02-16 20:24:00 +01:00
|
|
|
$(OBJDIR)/%.o: %.cpp config.h config.mk
|
2014-08-29 16:35:56 -03:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@$(if $(Q), $(shell echo echo CXX $<),)
|
2016-07-20 23:27:26 -03:00
|
|
|
$(Q)$(CXX) $(CPPFLAGS) $(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 $@)
|
2015-04-20 00:44:28 +02:00
|
|
|
@$(if $(Q), $(shell echo echo OBJC $<),)
|
2015-04-20 00:38:55 +02:00
|
|
|
$(Q)$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
|
|
|
|
2014-01-11 18:51:42 +01:00
|
|
|
.FORCE:
|
|
|
|
|
2014-02-02 15:29:07 +01:00
|
|
|
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
|
|
|
@mkdir -p $(dir $@)
|
2014-01-11 18:51:42 +01:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2014-03-27 22:19:06 +01:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
2014-01-11 18:51:42 +01:00
|
|
|
|
2014-02-02 15:29:07 +01: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)
|
2014-02-02 15:29:07 +01:00
|
|
|
rm -f $(OBJDIR)/git_version.o
|
2016-08-27 21:44:53 -07:00
|
|
|
mkdir -p $(DESTDIR)$(BIN_DIR) 2>/dev/null || /bin/true
|
2013-05-28 01:59:06 +02:00
|
|
|
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
2015-06-11 10:42:35 -07:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
|
2016-05-22 17:05:13 -07:00
|
|
|
mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true
|
2013-01-26 17:50:22 +01:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
|
2016-08-26 17:29:50 -07:00
|
|
|
install -m755 $(TARGET) $(DESTDIR)$(BIN_DIR)
|
|
|
|
install -m755 tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
2013-05-28 01:59:06 +02:00
|
|
|
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2015-06-11 10:42:35 -07:00
|
|
|
install -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
|
2016-05-22 17:05:13 -07:00
|
|
|
install -m644 docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
|
|
|
|
install -m644 docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
|
2014-07-10 23:16:13 -03:00
|
|
|
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
|
2016-08-28 04:09:56 +02:00
|
|
|
@if test -d media/assets; then \
|
|
|
|
echo "Installing media assets..."; \
|
2016-08-27 21:44:53 -07:00
|
|
|
mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb; \
|
2016-08-27 19:44:41 -07:00
|
|
|
mkdir -p $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/glui; \
|
|
|
|
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \
|
|
|
|
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/retroarch/assets; \
|
2016-08-28 04:09:56 +02:00
|
|
|
echo "Removing unneeded source image files.."; \
|
2016-08-27 19:44:41 -07:00
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/flatui/src; \
|
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/monochrome/src; \
|
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/retroactive/src; \
|
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch/assets/xmb/retroactive_marked/src; \
|
2016-08-28 04:09:56 +02:00
|
|
|
echo "Asset copying done."; \
|
|
|
|
fi
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2011-01-09 15:58:49 +01:00
|
|
|
uninstall:
|
2016-08-27 08:24:30 -07:00
|
|
|
rm -f $(DESTDIR)$(BIN_DIR)/retroarch
|
2016-08-26 17:29:50 -07:00
|
|
|
rm -f $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
2013-05-28 01:59:06 +02:00
|
|
|
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2015-06-11 10:42:35 -07:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
|
2016-05-22 17:05:13 -07:00
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
2014-07-10 23:16:13 -03:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
|
2016-08-28 17:08:19 -07:00
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)/retroarch
|
2010-05-26 21:27:37 +02:00
|
|
|
|
|
|
|
clean:
|
2014-02-02 15:29:07 +01:00
|
|
|
rm -rf $(OBJDIR)
|
2010-08-19 20:29:32 +02:00
|
|
|
rm -f $(TARGET)
|
2014-11-18 16:01:36 +01:00
|
|
|
rm -f *.d
|
2010-06-27 15:46:23 +02:00
|
|
|
|
|
|
|
.PHONY: all install uninstall clean
|