2015-06-12 15:31:28 +00:00
|
|
|
HAVE_FILE_LOGGER=1
|
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
|
|
|
|
2014-10-16 05:36:06 +00:00
|
|
|
TARGET = retroarch
|
2014-09-13 22:18:50 +00:00
|
|
|
JTARGET = tools/retroarch-joyconfig
|
2010-05-26 19:27:37 +00:00
|
|
|
|
2014-02-02 14:29:07 +00:00
|
|
|
OBJDIR := obj-unix
|
|
|
|
|
2014-09-13 22:11:08 +00:00
|
|
|
ifeq ($(GLOBAL_CONFIG_DIR),)
|
|
|
|
GLOBAL_CONFIG_DIR = /etc
|
|
|
|
endif
|
|
|
|
|
2014-09-13 22:04:42 +00:00
|
|
|
OBJ :=
|
2014-09-13 23:58:57 +00:00
|
|
|
JOYCONFIG_OBJ :=
|
2014-09-13 22:11:08 +00:00
|
|
|
LIBS :=
|
2014-09-24 07:39:41 +00:00
|
|
|
DEFINES := -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_OVERLAY
|
2014-09-13 22:11:08 +00:00
|
|
|
DEFINES += -DGLOBAL_CONFIG_DIR='"$(GLOBAL_CONFIG_DIR)"'
|
2012-06-19 22:43:41 +00:00
|
|
|
|
2014-09-16 01:15:00 +00:00
|
|
|
ifneq ($(findstring Win32,$(OS)),)
|
|
|
|
LDFLAGS += -static-libgcc
|
|
|
|
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)
|
|
|
|
DEFINES += -Wno-invalid-source-encoding
|
|
|
|
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)
|
|
|
|
DEFINES += -Werror=missing-declarations
|
|
|
|
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
|
|
|
|
|
2011-10-07 15:43:39 +00:00
|
|
|
ifeq ($(DEBUG), 1)
|
2015-06-05 21:22:44 +00:00
|
|
|
OPTIMIZE_FLAG = -O0 -g
|
|
|
|
else
|
|
|
|
OPTIMIZE_FLAG = -O3 -ffast-math
|
2011-10-07 15:43:39 +00:00
|
|
|
endif
|
|
|
|
|
2015-04-19 22:38:55 +00:00
|
|
|
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
|
2015-09-06 12:51:16 +00:00
|
|
|
CXXFLAGS := $(CFLAGS) -std=c++98 -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
|
|
|
|
2011-12-24 12:46:12 +00:00
|
|
|
ifeq ($(CXX_BUILD), 1)
|
2014-06-15 19:45:25 +00:00
|
|
|
LINK = $(CXX)
|
2014-09-15 15:19:56 +00:00
|
|
|
CFLAGS := $(CXXFLAGS) -xc++
|
2011-12-24 12:46:12 +00:00
|
|
|
else
|
2014-08-29 19:35:56 +00:00
|
|
|
ifeq ($(findstring Win32,$(OS)),)
|
|
|
|
LINK = $(CC)
|
|
|
|
else
|
|
|
|
# directx-related code is c++
|
|
|
|
LINK = $(CXX)
|
|
|
|
endif
|
|
|
|
|
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))
|
|
|
|
RARCH_JOYCONFIG_OBJ := $(addprefix $(OBJDIR)/,$(JOYCONFIG_OBJ))
|
2013-04-25 22:43:14 +00:00
|
|
|
|
2015-05-19 18:11:34 +00:00
|
|
|
ifneq ($(SANITIZER),)
|
|
|
|
CFLAGS := -fsanitize=$(SANITIZER) $(CFLAGS)
|
|
|
|
CXXFLAGS := -fsanitize=$(SANITIZER) $(CXXFLAGS)
|
|
|
|
LDFLAGS := -fsanitize=$(SANITIZER) $(LDLAGS)
|
|
|
|
endif
|
|
|
|
|
2014-09-13 22:18:50 +00:00
|
|
|
all: $(TARGET) $(JTARGET) config.mk
|
2010-12-30 01:56:56 +00:00
|
|
|
|
2014-10-16 05:34:59 +00:00
|
|
|
-include $(RARCH_OBJ:.o=.d) $(RARCH_JOYCONFIG_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
|
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 $@),)
|
2014-06-15 19:45:25 +00:00
|
|
|
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2010-06-27 13:46:23 +00:00
|
|
|
|
2014-09-13 22:18:50 +00:00
|
|
|
$(JTARGET): $(RARCH_JOYCONFIG_OBJ)
|
2013-01-04 20:56:15 +00:00
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2014-09-15 15:19:56 +00:00
|
|
|
$(Q)$(LINK) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2011-01-09 14:58:49 +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 $<),)
|
2014-03-27 21:19:06 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2014-08-29 19:35:56 +00:00
|
|
|
$(OBJDIR)/%.o: %.cpp
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
@$(if $(Q), $(shell echo echo CXX $<),)
|
2014-09-15 15:19:56 +00:00
|
|
|
$(Q)$(CXX) $(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-03-27 21:19:06 +00:00
|
|
|
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c
|
2014-02-02 14:29:07 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2013-04-25 22:43:14 +00:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2014-03-27 21:19:06 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
2013-04-26 09:44:54 +00:00
|
|
|
|
2014-10-04 03:18:36 +00: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 $@ $<
|
|
|
|
|
2014-03-27 21:19:06 +00:00
|
|
|
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c
|
2014-02-02 14:29:07 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2013-09-25 17:32:18 +00:00
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2014-03-27 21:19:06 +00:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -DIS_JOYCONFIG -c -o $@ $<
|
2013-09-25 17:32:18 +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
|
2011-05-19 13:40:39 +00:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
2013-05-27 23:59:06 +00:00
|
|
|
mkdir -p $(DESTDIR)$(GLOBAL_CONFIG_DIR) 2>/dev/null || /bin/true
|
2015-06-11 17:42:35 +00:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/applications 2>/dev/null || /bin/true
|
2015-08-20 05:15:44 +00:00
|
|
|
mkdir -p $(DESTDIR)$(MAN_DIR) 2>/dev/null || /bin/true
|
2013-01-26 16:50:22 +00:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps 2>/dev/null || /bin/true
|
2011-01-05 19:47:31 +00:00
|
|
|
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
|
2013-10-07 20:09:05 +00:00
|
|
|
install -m755 tools/cg2glsl.py $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
2015-03-06 09:58:30 +00:00
|
|
|
install -m755 $(JTARGET) $(DESTDIR)$(PREFIX)/bin
|
2013-05-27 23:59:06 +00:00
|
|
|
install -m644 retroarch.cfg $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2015-06-11 17:42:35 +00:00
|
|
|
install -m644 retroarch.desktop $(DESTDIR)$(PREFIX)/share/applications
|
2012-12-02 09:59:48 +00:00
|
|
|
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
|
2014-07-11 02:16:13 +00:00
|
|
|
install -m644 docs/retroarch-cg2glsl.1 $(DESTDIR)$(MAN_DIR)
|
2012-12-02 09:59:48 +00:00
|
|
|
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(MAN_DIR)
|
2014-07-11 02:16:13 +00:00
|
|
|
install -m644 media/retroarch.svg $(DESTDIR)$(PREFIX)/share/pixmaps
|
2010-05-28 12:04:50 +00:00
|
|
|
|
2011-01-09 14:58:49 +00:00
|
|
|
uninstall:
|
2012-04-21 21:31:57 +00:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
|
2013-10-07 20:09:05 +00:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-cg2glsl
|
2013-05-27 23:59:06 +00:00
|
|
|
rm -f $(DESTDIR)$(GLOBAL_CONFIG_DIR)/retroarch.cfg
|
2015-06-11 17:42:35 +00:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/applications/retroarch.desktop
|
2015-08-20 05:15:44 +00:00
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/retroarch.1
|
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/retroarch-cg2glsl.1
|
|
|
|
rm -f $(DESTDIR)$(MAN_DIR)/retroarch-joyconfig.1
|
2014-07-11 02:16:13 +00:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.svg
|
2010-05-26 19:27:37 +00:00
|
|
|
|
|
|
|
clean:
|
2014-02-02 14:29:07 +00:00
|
|
|
rm -rf $(OBJDIR)
|
2010-08-19 18:29:32 +00:00
|
|
|
rm -f $(TARGET)
|
2014-09-13 22:18:50 +00:00
|
|
|
rm -f $(JTARGET)
|
2014-11-18 15:01:36 +00:00
|
|
|
rm -f *.d
|
2010-06-27 13:46:23 +00:00
|
|
|
|
|
|
|
.PHONY: all install uninstall clean
|