2015-06-12 15:31:28 +00:00
|
|
|
HAVE_FILE_LOGGER=1
|
2016-12-12 11:48:04 +00:00
|
|
|
HAVE_CC_RESAMPLER=1
|
2016-06-26 19:26:21 +00:00
|
|
|
NEED_CXX_LINKER=0
|
2015-09-06 13:12:32 +00:00
|
|
|
MISSING_DECLS =0
|
2015-06-12 15:31:28 +00:00
|
|
|
|
2015-09-22 11:08:46 +00:00
|
|
|
ifneq ($(C90_BUILD),)
|
|
|
|
C89_BUILD=1
|
|
|
|
endif
|
|
|
|
|
2010-05-29 15:01:11 +00:00
|
|
|
include config.mk
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2017-12-29 20:07:30 +00:00
|
|
|
# Put your favorite compile flags in this file, if you want different defaults than upstream.
|
|
|
|
# Do not attempt to create that file upstream.
|
|
|
|
# (It'd be better to put this comment in that file, but .gitignore doesn't work on files that exist in the repo.)
|
2017-12-29 20:16:28 +00:00
|
|
|
-include Makefile.local
|
2017-12-29 20:07:30 +00:00
|
|
|
|
2014-10-16 05:36:06 +00:00
|
|
|
TARGET = retroarch
|
2010-05-26 19:27:37 +00:00
|
|
|
|
2018-01-30 16:57:54 +00:00
|
|
|
OBJDIR_BASE := obj-unix
|
|
|
|
|
2018-01-20 19:02:45 +00:00
|
|
|
ifeq ($(DEBUG), 1)
|
2018-01-30 16:57:54 +00:00
|
|
|
OBJDIR := $(OBJDIR_BASE)/debug
|
2018-01-20 19:02:45 +00:00
|
|
|
else
|
2018-01-30 16:57:54 +00:00
|
|
|
OBJDIR := $(OBJDIR_BASE)/release
|
2018-01-20 19:02:45 +00:00
|
|
|
endif
|
2014-02-02 14:29:07 +00:00
|
|
|
|
2017-01-31 02:13:44 +00:00
|
|
|
OBJ :=
|
2014-09-13 22:11:08 +00:00
|
|
|
LIBS :=
|
2018-02-14 06:16:12 +00:00
|
|
|
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64
|
2014-09-13 22:11:08 +00:00
|
|
|
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
2012-06-19 22:43:41 +00:00
|
|
|
|
2017-03-29 16:47:58 +00:00
|
|
|
ifneq ($(findstring BSD,$(OS)),)
|
|
|
|
CFLAGS += -DBSD
|
|
|
|
LDFLAGS += -L/usr/local/lib
|
|
|
|
endif
|
|
|
|
|
2017-01-21 21:36:38 +00:00
|
|
|
ifneq ($(findstring DOS,$(OS)),)
|
|
|
|
CFLAGS += -march=i386
|
|
|
|
LDFLAGS += -lemu
|
|
|
|
endif
|
|
|
|
|
2014-09-16 01:15:00 +00:00
|
|
|
ifneq ($(findstring Win32,$(OS)),)
|
2017-02-05 13:13:30 +00:00
|
|
|
LDFLAGS += -static-libgcc -lwinmm
|
2014-09-16 01:15:00 +00:00
|
|
|
endif
|
|
|
|
|
2014-09-13 22:04:42 +00:00
|
|
|
include Makefile.common
|
2014-06-07 19:18:58 +00:00
|
|
|
|
2015-09-05 14:48:11 +00:00
|
|
|
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang"),1)
|
2018-04-09 15:35:27 +00:00
|
|
|
DEFINES += -Wno-invalid-source-encoding -Wno-incompatible-ms-struct
|
2015-09-05 14:48:11 +00:00
|
|
|
endif
|
|
|
|
|
2016-10-02 15:31:19 +00:00
|
|
|
ifeq ($(shell $(CC) -v 2>&1 | grep -c "tcc"),1)
|
|
|
|
MD = -MD
|
|
|
|
else
|
|
|
|
MD = -MMD
|
|
|
|
endif
|
|
|
|
|
2014-01-11 18:08:24 +00:00
|
|
|
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
|
2010-11-19 20:26:31 +00:00
|
|
|
|
2015-09-06 12:45:24 +00:00
|
|
|
ifeq ($(MISSING_DECLS), 1)
|
2016-07-15 13:40:06 +00:00
|
|
|
DEFINES += -Werror=missing-declarations
|
2015-09-06 12:45:24 +00:00
|
|
|
endif
|
|
|
|
|
2011-05-11 15:52:16 +00:00
|
|
|
ifeq ($(HAVE_DYLIB), 1)
|
2011-06-16 20:47:37 +00:00
|
|
|
LIBS += $(DYLIB_LIB)
|
2010-05-29 14:59:57 +00:00
|
|
|
endif
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2010-12-30 13:26:12 +00:00
|
|
|
ifeq ($(HAVE_DYNAMIC), 1)
|
2011-06-16 20:47:37 +00:00
|
|
|
LIBS += $(DYLIB_LIB)
|
2010-12-30 13:26:12 +00:00
|
|
|
else
|
2012-04-22 08:46:06 +00:00
|
|
|
LIBS += $(libretro)
|
2010-12-30 12:54:49 +00:00
|
|
|
endif
|
|
|
|
|
2011-01-10 16:15:27 +00:00
|
|
|
ifneq ($(V),1)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2017-12-29 19:00:53 +00:00
|
|
|
ifeq ($(DEBUG), 1)
|
2015-06-05 21:22:44 +00:00
|
|
|
OPTIMIZE_FLAG = -O0 -g
|
2018-01-20 19:02:45 +00:00
|
|
|
DEFINES += -DDEBUG -D_DEBUG
|
2015-06-05 21:22:44 +00:00
|
|
|
else
|
|
|
|
OPTIMIZE_FLAG = -O3 -ffast-math
|
2011-10-07 15:43:39 +00:00
|
|
|
endif
|
|
|
|
|
2016-10-08 20:33:29 +00:00
|
|
|
ifneq ($(findstring Win32,$(OS)),)
|
|
|
|
LDFLAGS += -mwindows
|
|
|
|
endif
|
|
|
|
|
2018-01-02 17:20:13 +00:00
|
|
|
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -I. -Ideps -Ideps/stb
|
2016-02-16 19:24:00 +00:00
|
|
|
|
|
|
|
APPEND_CFLAGS := $(CFLAGS)
|
|
|
|
CXXFLAGS += $(APPEND_CFLAGS) -std=c++11 -D__STDC_CONSTANT_MACROS
|
2015-04-19 22:38:55 +00:00
|
|
|
OBJCFLAGS := $(CFLAGS) -D__STDC_CONSTANT_MACROS
|
2014-08-29 19:35:56 +00:00
|
|
|
|
2018-05-02 16:15:20 +00:00
|
|
|
ifeq ($(HAVE_CXX), 1)
|
|
|
|
ifeq ($(CXX_BUILD), 1)
|
2016-07-15 13:40:06 +00:00
|
|
|
LINK = $(CXX)
|
2018-05-02 16:15:20 +00:00
|
|
|
CFLAGS := $(CXXFLAGS) -xc++
|
|
|
|
CFLAGS += -DCXX_BUILD
|
|
|
|
CXXFLAGS += -DCXX_BUILD
|
|
|
|
else ifeq ($(NEED_CXX_LINKER),1)
|
2014-08-29 19:35:56 +00:00
|
|
|
LINK = $(CXX)
|
2018-05-02 16:15:20 +00:00
|
|
|
else
|
|
|
|
LINK = $(CC)
|
2014-08-29 19:35:56 +00:00
|
|
|
endif
|
2018-05-02 16:15:20 +00:00
|
|
|
else
|
|
|
|
LINK = $(CC)
|
2018-05-03 22:43:37 +00:00
|
|
|
endif
|
2014-08-29 19:35:56 +00:00
|
|
|
|
2018-05-03 22:43:37 +00:00
|
|
|
ifneq ($(CXX_BUILD), 1)
|
2013-10-22 19:41:51 +00:00
|
|
|
ifneq ($(GNU90_BUILD), 1)
|
|
|
|
ifneq ($(findstring icc,$(CC)),)
|
|
|
|
CFLAGS += -std=c99 -D_GNU_SOURCE
|
|
|
|
else
|
2014-06-08 10:37:32 +00:00
|
|
|
CFLAGS += -std=gnu99 -D_GNU_SOURCE
|
2013-10-22 19:41:51 +00:00
|
|
|
endif
|
2012-09-18 10:16:27 +00:00
|
|
|
endif
|
2015-06-26 13:43:45 +00:00
|
|
|
|
2015-09-22 11:08:46 +00:00
|
|
|
ifneq ($(C89_BUILD),)
|
2015-09-22 11:32:56 +00:00
|
|
|
CFLAGS += -std=c89 -ansi -pedantic -Werror=pedantic -Wno-long-long
|
2015-06-26 13:43:45 +00:00
|
|
|
endif
|
2011-12-24 12:46:12 +00:00
|
|
|
endif
|
2010-05-26 19:27:37 +00:00
|
|
|
|
2012-05-01 21:00:37 +00:00
|
|
|
ifeq ($(NOUNUSED), yes)
|
|
|
|
CFLAGS += -Wno-unused-result
|
2014-09-15 15:19:56 +00:00
|
|
|
CXXFLAGS += -Wno-unused-result
|
2012-05-01 21:00:37 +00:00
|
|
|
endif
|
2013-03-16 11:24:53 +00:00
|
|
|
ifeq ($(NOUNUSED_VARIABLE), yes)
|
|
|
|
CFLAGS += -Wno-unused-variable
|
2014-09-15 15:19:56 +00:00
|
|
|
CXXFLAGS += -Wno-unused-variable
|
2013-03-16 11:24:53 +00:00
|
|
|
endif
|
2012-05-01 21:00:37 +00:00
|
|
|
|
2014-02-02 14:29:07 +00:00
|
|
|
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
|
2013-04-25 22:43:14 +00:00
|
|
|
|
2017-11-22 04:57:20 +00:00
|
|
|
ifneq ($(X86),)
|
|
|
|
CFLAGS += -m32
|
2018-04-13 07:35:33 +00:00
|
|
|
CXXFLAGS += -m32
|
2017-11-22 04:57:20 +00:00
|
|
|
LDFLAGS += -m32
|
|
|
|
endif
|
|
|
|
|
2015-05-19 18:11:34 +00:00
|
|
|
ifneq ($(SANITIZER),)
|
2017-11-22 04:57:20 +00:00
|
|
|
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
|
|
|
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
|
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
|
2015-05-19 18:11:34 +00:00
|
|
|
endif
|
|
|
|
|
2015-11-24 16:49:36 +00:00
|
|
|
ifneq ($(findstring $(GPERFTOOLS),profiler),)
|
|
|
|
LIBS += -lprofiler
|
|
|
|
endif
|
|
|
|
ifneq ($(findstring $(GPERFTOOLS),tcmalloc),)
|
|
|
|
LIBS += -ltcmalloc
|
|
|
|
endif
|
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
# Qt MOC generation, required for QObject-derived classes
|
|
|
|
ifneq ($(MOC_HEADERS),)
|
|
|
|
# prefix moc_ to base filename of paths and change extension from h to cpp, so a/b/foo.h becomes a/b/moc_foo.cpp
|
|
|
|
MOC_SRC := $(join $(addsuffix moc_,$(addprefix $(OBJDIR)/,$(dir $(MOC_HEADERS)))), $(notdir $(MOC_HEADERS:.h=.cpp)))
|
|
|
|
MOC_OBJ := $(patsubst %.cpp,%.o,$(MOC_SRC))
|
|
|
|
RARCH_OBJ += $(MOC_OBJ)
|
|
|
|
endif
|
|
|
|
|
2015-11-11 19:18:45 +00:00
|
|
|
all: $(TARGET) config.mk
|
2010-12-30 01:56:56 +00:00
|
|
|
|
2018-04-30 18:33:05 +00:00
|
|
|
$(MOC_SRC):
|
|
|
|
@$(if $(Q), $(shell echo echo MOC $<),)
|
|
|
|
$(eval MOC_TMP := $(patsubst %.h,%_moc.cpp,$@))
|
|
|
|
$(Q)$(MOC) -o $(MOC_TMP) $<
|
|
|
|
|
|
|
|
$(foreach x,$(join $(addsuffix :,$(MOC_SRC)),$(MOC_HEADERS)),$(eval $x))
|
|
|
|
|
|
|
|
$(MOC_OBJ):
|
|
|
|
@$(if $(Q), $(shell echo echo CXX $<),)
|
|
|
|
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
|
|
|
|
|
|
|
$(foreach x,$(join $(addsuffix :,$(MOC_OBJ)),$(MOC_SRC)),$(eval $x))
|
|
|
|
|
2016-07-15 13:42:26 +00:00
|
|
|
ifeq ($(MAKECMDGOALS),clean)
|
|
|
|
config.mk:
|
|
|
|
else
|
2015-11-11 19:15:27 +00:00
|
|
|
-include $(RARCH_OBJ:.o=.d)
|
2010-12-30 01:56:56 +00:00
|
|
|
config.mk: configure qb/*
|
|
|
|
@echo "config.mk is outdated or non-existing. Run ./configure again."
|
2010-12-30 02:23:12 +00:00
|
|
|
@exit 1
|
2016-07-15 13:42:26 +00:00
|
|
|
endif
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2014-02-02 14:29:07 +00:00
|
|
|
retroarch: $(RARCH_OBJ)
|
2011-01-10 16:15:27 +00:00
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2016-09-08 16:23:26 +00:00
|
|
|
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2010-06-27 13:46:23 +00:00
|
|
|
|
2014-03-27 21:19:06 +00:00
|
|
|
$(OBJDIR)/%.o: %.c config.h config.mk
|
2014-02-02 14:29:07 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2011-01-10 16:15:27 +00:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2016-10-02 15:31:19 +00:00
|
|
|
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(MD) -c -o $@ $<
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2016-02-16 19:24:00 +00:00
|
|
|
$(OBJDIR)/%.o: %.cpp config.h config.mk
|
2014-08-29 19:35:56 +00:00
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@$(if $(Q), $(shell echo echo CXX $<),)
|
2016-07-21 02:27:26 +00:00
|
|
|
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
2014-08-29 19:35:56 +00:00
|
|
|
|
2015-04-19 22:38:55 +00:00
|
|
|
$(OBJDIR)/%.o: %.m
|
|
|
|
@mkdir -p $(dir $@)
|
2015-04-19 22:44:28 +00:00
|
|
|
@$(if $(Q), $(shell echo echo OBJC $<),)
|
2015-04-19 22:38:55 +00:00
|
|
|
$(Q)$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
|
|
|
|
2014-01-11 17:51:42 +00:00
|
|
|
.FORCE:
|
|
|
|
|
2014-02-02 14:29:07 +00:00
|
|
|
$(OBJDIR)/git_version.o: git_version.c .FORCE
|
|
|
|
@mkdir -p $(dir $@)
|
2014-01-11 17:51:42 +00:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2014-03-27 21:19:06 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
2014-01-11 17:51:42 +00:00
|
|
|
|
2014-02-02 14:29:07 +00:00
|
|
|
$(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
|
|
|
|
@mkdir -p $(dir $@)
|
2012-12-09 17:37:09 +00:00
|
|
|
@$(if $(Q), $(shell echo echo AS $<),)
|
2013-01-04 20:56:15 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
|
2012-12-09 15:28:49 +00:00
|
|
|
|
2014-09-14 20:50:29 +00:00
|
|
|
$(OBJDIR)/%.o: %.rc $(HEADERS)
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@$(if $(Q), $(shell echo echo WINDRES $<),)
|
|
|
|
$(Q)$(WINDRES) -o $@ $<
|
|
|
|
|
2010-05-28 12:04:50 +00:00
|
|
|
install: $(TARGET)
|
2014-02-02 14:29:07 +00:00
|
|
|
rm -f $(OBJDIR)/git_version.o
|
2016-08-28 04:44:53 +00:00
|
|
|
mkdir -p $(DESTDIR)$(BIN_DIR) 2>/dev/null || /bin/true
|
2013-05-27 23:59:06 +00:00
|
|
|
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
2018-02-04 21:06:58 +00:00
|
|
|
mkdir -p $(DESTDIR)$(DATA_DIR)/applications 2>/dev/null || /bin/true
|
2018-02-10 16:30:20 +00:00
|
|
|
mkdir -p $(DESTDIR)$(DOC_DIR) 2>/dev/null || /bin/true
|
2016-05-23 00:05:13 +00:00
|
|
|
mkdir -p $(DESTDIR)$(MAN_DIR)/man6 2>/dev/null || /bin/true
|
2018-02-04 21:06:58 +00:00
|
|
|
mkdir -p $(DESTDIR)$(DATA_DIR)/pixmaps 2>/dev/null || /bin/true
|
2018-01-15 18:21:38 +00:00
|
|
|
cp $(TARGET) $(DESTDIR)$(BIN_DIR)
|
|
|
|
cp tools/cg2glsl.py $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
|
|
|
cp retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)
|
2018-02-04 21:06:58 +00:00
|
|
|
cp retroarch.desktop $(DESTDIR)$(DATA_DIR)/applications
|
2018-01-15 18:21:38 +00:00
|
|
|
cp docs/retroarch.6 $(DESTDIR)$(MAN_DIR)/man6
|
|
|
|
cp docs/retroarch-cg2glsl.6 $(DESTDIR)$(MAN_DIR)/man6
|
2018-02-04 21:06:58 +00:00
|
|
|
cp media/retroarch.svg $(DESTDIR)$(DATA_DIR)/pixmaps
|
2018-02-10 16:30:20 +00:00
|
|
|
cp COPYING $(DESTDIR)$(DOC_DIR)
|
|
|
|
cp README.md $(DESTDIR)$(DOC_DIR)
|
2018-01-15 18:21:38 +00:00
|
|
|
chmod 755 $(DESTDIR)$(BIN_DIR)/$(TARGET)
|
|
|
|
chmod 755 $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
|
|
|
chmod 644 $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2018-02-04 21:06:58 +00:00
|
|
|
chmod 644 $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop
|
2018-01-15 18:21:38 +00:00
|
|
|
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
|
|
|
chmod 644 $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
2018-02-04 21:06:58 +00:00
|
|
|
chmod 644 $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg
|
2016-08-28 02:09:56 +00:00
|
|
|
@if test -d media/assets; then \
|
|
|
|
echo "Installing media assets..."; \
|
2018-02-04 21:06:58 +00:00
|
|
|
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/xmb; \
|
|
|
|
mkdir -p $(DESTDIR)$(ASSETS_DIR)/assets/glui; \
|
|
|
|
cp -r media/assets/xmb/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
|
|
|
cp -r media/assets/glui/ $(DESTDIR)$(ASSETS_DIR)/assets; \
|
2018-02-10 16:30:20 +00:00
|
|
|
cp media/assets/COPYING $(DESTDIR)$(DOC_DIR)/COPYING.assets; \
|
2016-08-28 02:09:56 +00:00
|
|
|
echo "Asset copying done."; \
|
|
|
|
fi
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2011-01-09 14:58:49 +00:00
|
|
|
uninstall:
|
2016-08-27 15:24:30 +00:00
|
|
|
rm -f $(DESTDIR)$(BIN_DIR)/retroarch
|
2016-08-27 00:29:50 +00:00
|
|
|
rm -f $(DESTDIR)$(BIN_DIR)/retroarch-cg2glsl
|
2013-05-27 23:59:06 +00:00
|
|
|
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2018-02-04 21:06:58 +00:00
|
|
|
rm -f $(DESTDIR)$(DATA_DIR)/applications/retroarch.desktop
|
2018-02-10 16:30:20 +00:00
|
|
|
rm -f $(DESTDIR)$(DATA_DIR)/pixmaps/retroarch.svg
|
|
|
|
rm -f $(DESTDIR)$(DOC_DIR)/COPYING
|
|
|
|
rm -f $(DESTDIR)$(DOC_DIR)/COPYING.assets
|
|
|
|
rm -f $(DESTDIR)$(DOC_DIR)/README.md
|
2016-05-23 00:05:13 +00:00
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch.6
|
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/man6/retroarch-cg2glsl.6
|
2018-02-04 21:06:58 +00:00
|
|
|
rm -rf $(DESTDIR)$(ASSETS_DIR)
|
2010-05-26 19:27:37 +00:00
|
|
|
|
|
|
|
clean:
|
2018-01-30 16:57:54 +00:00
|
|
|
rm -rf $(OBJDIR_BASE)
|
2010-08-19 18:29:32 +00:00
|
|
|
rm -f $(TARGET)
|
2014-11-18 15:01:36 +00:00
|
|
|
rm -f *.d
|
2010-06-27 13:46:23 +00:00
|
|
|
|
|
|
|
.PHONY: all install uninstall clean
|
2018-04-30 18:33:05 +00:00
|
|
|
|
|
|
|
print-%:
|
|
|
|
@echo '$*=$($*)'
|