2010-05-29 17:01:11 +02:00
|
|
|
include config.mk
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2012-04-21 23:11:18 +02:00
|
|
|
TARGET = retroarch tools/retroarch-joyconfig
|
2010-05-26 21:27:37 +02:00
|
|
|
|
2012-04-21 23:11:18 +02:00
|
|
|
OBJ = retroarch.o file.o file_path.o hash.o driver.o settings.o dynamic.o message.o rewind.o gfx/gfx_common.o patch.o compat/compat.o screenshot.o audio/utils.o
|
2012-04-21 23:31:57 +02:00
|
|
|
JOYCONFIG_OBJ = tools/retroarch-joyconfig.o conf/config_file.o compat/compat.o
|
2011-01-10 15:01:34 +01:00
|
|
|
HEADERS = $(wildcard */*.h) $(wildcard *.h)
|
2010-11-19 21:26:31 +01:00
|
|
|
|
2011-11-30 17:46:58 +01:00
|
|
|
LIBS = -lm
|
2012-03-26 00:04:12 +02:00
|
|
|
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2012-02-01 21:32:27 +01:00
|
|
|
ifeq ($(REENTRANT_TEST), 1)
|
2012-04-21 23:31:57 +02:00
|
|
|
DEFINES += -Dmain=retroarch_main
|
2012-02-01 21:32:27 +01:00
|
|
|
OBJ += console/test.o
|
|
|
|
endif
|
|
|
|
|
2011-06-25 17:22:47 +02:00
|
|
|
ifneq ($(findstring Darwin,$(OS)),)
|
2011-02-04 22:47:37 +01:00
|
|
|
OSX := 1
|
2011-02-04 23:53:33 +01:00
|
|
|
LIBS += -framework AppKit
|
2011-02-04 22:47:37 +01:00
|
|
|
else
|
|
|
|
OSX := 0
|
|
|
|
endif
|
|
|
|
|
2011-06-16 22:47:37 +02:00
|
|
|
BSD_LOCAL_INC =
|
|
|
|
DYLIB_LIB = -ldl
|
2011-06-25 17:22:47 +02:00
|
|
|
ifneq ($(findstring BSD,$(OS)),)
|
2011-06-16 22:47:37 +02:00
|
|
|
BSD_LOCAL_INC = -I/usr/local/include
|
|
|
|
DYLIB_LIB = -lc
|
|
|
|
endif
|
|
|
|
|
2011-10-06 20:34:01 +02:00
|
|
|
ifneq ($(findstring Linux,$(OS)),)
|
|
|
|
LIBS += -lrt
|
|
|
|
endif
|
|
|
|
|
2011-11-30 17:46:58 +01:00
|
|
|
ifeq ($(HAVE_THREADS), 1)
|
2011-11-30 18:18:50 +01:00
|
|
|
OBJ += autosave.o thread.o
|
2011-11-30 17:46:58 +01:00
|
|
|
LIBS += -lpthread
|
|
|
|
endif
|
|
|
|
|
2011-01-19 12:54:19 +01:00
|
|
|
ifeq ($(HAVE_CONFIGFILE), 1)
|
|
|
|
OBJ += conf/config_file.o
|
|
|
|
endif
|
|
|
|
|
2012-03-26 00:04:12 +02:00
|
|
|
ifeq ($(HAVE_BSV_MOVIE), 1)
|
|
|
|
OBJ += movie.o
|
|
|
|
endif
|
|
|
|
|
2011-03-19 20:41:07 +01:00
|
|
|
ifeq ($(HAVE_NETPLAY), 1)
|
|
|
|
OBJ += netplay.o
|
|
|
|
endif
|
|
|
|
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_RSOUND), 1)
|
2010-12-24 02:18:39 +01:00
|
|
|
OBJ += audio/rsound.o
|
2011-06-29 04:54:30 +02:00
|
|
|
LIBS += $(RSOUND_LIBS)
|
|
|
|
DEFINES += $(RSOUND_CFLAGS)
|
2010-05-28 14:04:50 +02:00
|
|
|
endif
|
2011-01-07 11:09:56 +01:00
|
|
|
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_OSS), 1)
|
2010-12-24 02:18:39 +01:00
|
|
|
OBJ += audio/oss.o
|
2010-05-28 14:33:18 +02:00
|
|
|
endif
|
2011-06-16 23:20:12 +02:00
|
|
|
ifeq ($(HAVE_OSS_BSD), 1)
|
|
|
|
OBJ += audio/oss.o
|
2011-06-16 23:50:33 +02:00
|
|
|
endif
|
|
|
|
ifeq ($(HAVE_OSS_LIB), 1)
|
2011-06-16 23:20:12 +02:00
|
|
|
LIBS += -lossaudio
|
|
|
|
endif
|
2011-06-16 23:50:33 +02:00
|
|
|
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_ALSA), 1)
|
2010-12-24 02:18:39 +01:00
|
|
|
OBJ += audio/alsa.o
|
2011-06-25 17:15:58 +02:00
|
|
|
LIBS += $(ALSA_LIBS)
|
|
|
|
DEFINES += $(ALSA_CFLAGS)
|
2010-05-28 15:41:38 +02:00
|
|
|
endif
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_ROAR), 1)
|
2010-12-24 02:18:39 +01:00
|
|
|
OBJ += audio/roar.o
|
2011-06-25 17:15:58 +02:00
|
|
|
LIBS += $(ROAR_LIBS)
|
|
|
|
DEFINES += $(ROAR_CFLAGS)
|
2010-08-16 21:20:07 +02:00
|
|
|
endif
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_AL), 1)
|
2010-12-24 02:18:39 +01:00
|
|
|
OBJ += audio/openal.o
|
2011-02-04 22:47:37 +01:00
|
|
|
ifeq ($(OSX),1)
|
2011-02-04 07:42:26 -06:00
|
|
|
LIBS += -framework OpenAL
|
|
|
|
else
|
2010-08-25 22:40:43 +02:00
|
|
|
LIBS += -lopenal
|
|
|
|
endif
|
2011-02-04 07:42:26 -06:00
|
|
|
endif
|
2011-01-01 03:53:30 +01:00
|
|
|
ifeq ($(HAVE_JACK),1)
|
|
|
|
OBJ += audio/jack.o
|
2011-03-13 18:09:27 +01:00
|
|
|
LIBS += $(JACK_LIBS)
|
|
|
|
DEFINES += $(JACK_CFLAGS)
|
2011-01-01 03:53:30 +01:00
|
|
|
endif
|
2011-01-29 01:15:09 +01:00
|
|
|
ifeq ($(HAVE_PULSE), 1)
|
|
|
|
OBJ += audio/pulse.o
|
|
|
|
LIBS += $(PULSE_LIBS)
|
|
|
|
DEFINES += $(PULSE_CFLAGS)
|
|
|
|
endif
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2011-08-08 17:27:52 +02:00
|
|
|
ifeq ($(HAVE_COREAUDIO), 1)
|
|
|
|
OBJ += audio/coreaudio.o
|
|
|
|
LIBS += -framework CoreServices -framework CoreAudio -framework AudioUnit
|
|
|
|
endif
|
|
|
|
|
2011-01-06 18:34:11 +01:00
|
|
|
ifeq ($(HAVE_SDL), 1)
|
2011-12-25 00:59:46 +01:00
|
|
|
OBJ += gfx/sdl_gfx.o gfx/sdlwrap.o input/sdl_input.o audio/sdl_audio.o fifo_buffer.o
|
2011-06-16 22:47:37 +02:00
|
|
|
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
|
2011-02-04 06:46:51 -06:00
|
|
|
LIBS += $(SDL_LIBS)
|
2011-11-01 18:24:43 +01:00
|
|
|
|
|
|
|
ifeq ($(HAVE_OPENGL), 1)
|
|
|
|
OBJ += gfx/gl.o
|
2011-02-04 22:47:37 +01:00
|
|
|
ifeq ($(OSX),1)
|
2011-11-01 18:24:43 +01:00
|
|
|
LIBS += -framework OpenGL
|
2011-02-04 06:46:51 -06:00
|
|
|
else
|
2011-11-01 18:24:43 +01:00
|
|
|
LIBS += -lGL
|
|
|
|
endif
|
2011-02-04 06:46:51 -06:00
|
|
|
endif
|
2010-05-28 14:04:50 +02:00
|
|
|
endif
|
2010-11-12 23:09:43 +01:00
|
|
|
|
2011-03-13 04:51:09 +01:00
|
|
|
ifeq ($(HAVE_XVIDEO), 1)
|
|
|
|
OBJ += gfx/xvideo.o input/x11_input.o
|
2011-10-23 12:48:44 +02:00
|
|
|
LIBS += $(XVIDEO_LIBS) $(X11_LIBS) $(XEXT_LIBS)
|
|
|
|
DEFINES += $(XVIDEO_CFLAGS) $(X11_CFLAGS) $(XEXT_CFLAGS)
|
2011-03-13 04:51:09 +01:00
|
|
|
endif
|
|
|
|
|
2010-12-30 02:56:56 +01:00
|
|
|
ifeq ($(HAVE_CG), 1)
|
2011-01-05 17:22:12 +01:00
|
|
|
OBJ += gfx/shader_cg.o
|
2010-11-12 23:09:43 +01:00
|
|
|
LIBS += -lCg -lCgGL
|
|
|
|
endif
|
|
|
|
|
2011-01-05 17:42:58 +01:00
|
|
|
ifeq ($(HAVE_XML), 1)
|
2012-03-25 23:29:39 +02:00
|
|
|
OBJ += cheats.o
|
2011-01-05 17:42:58 +01:00
|
|
|
LIBS += $(XML_LIBS)
|
|
|
|
DEFINES += $(XML_CFLAGS)
|
2011-11-01 18:24:43 +01:00
|
|
|
|
|
|
|
ifeq ($(HAVE_OPENGL), 1)
|
|
|
|
OBJ += gfx/shader_glsl.o
|
|
|
|
endif
|
2011-01-05 17:42:58 +01:00
|
|
|
endif
|
|
|
|
|
2011-10-17 15:35:02 +02:00
|
|
|
ifeq ($(HAVE_XML), 1)
|
2012-04-07 12:17:40 +02:00
|
|
|
OBJ += gfx/state_tracker.o gfx/image.o
|
2011-10-17 15:35:02 +02:00
|
|
|
else ifeq ($(HAVE_CG), 1)
|
2012-04-07 12:17:40 +02:00
|
|
|
OBJ += gfx/state_tracker.o gfx/image.o
|
2011-10-17 15:35:02 +02:00
|
|
|
endif
|
|
|
|
|
2011-05-11 17:52:16 +02:00
|
|
|
ifeq ($(HAVE_DYLIB), 1)
|
2011-12-25 00:59:46 +01:00
|
|
|
OBJ += gfx/ext_gfx.o audio/ext_audio.o
|
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
|
|
|
|
2011-01-23 00:27:20 +01:00
|
|
|
ifeq ($(HAVE_FREETYPE), 1)
|
|
|
|
OBJ += gfx/fonts.o
|
|
|
|
LIBS += $(FREETYPE_LIBS)
|
|
|
|
DEFINES += $(FREETYPE_CFLAGS)
|
|
|
|
endif
|
|
|
|
|
2011-06-11 16:55:53 +02:00
|
|
|
ifeq ($(HAVE_SDL_IMAGE), 1)
|
|
|
|
LIBS += $(SDL_IMAGE_LIBS)
|
|
|
|
DEFINES += $(SDL_IMAGE_CFLAGS)
|
2011-05-18 20:22:27 +02:00
|
|
|
endif
|
|
|
|
|
2011-01-05 19:51:19 +01:00
|
|
|
ifeq ($(HAVE_FFMPEG), 1)
|
|
|
|
OBJ += record/ffemu.o
|
2011-06-15 04:34:28 +02:00
|
|
|
LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS)
|
|
|
|
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS)
|
2011-01-05 19:51:19 +01:00
|
|
|
endif
|
|
|
|
|
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
|
|
|
|
LIBS += $(libsnes)
|
2010-12-30 13:54:49 +01:00
|
|
|
endif
|
|
|
|
|
2011-06-06 17:44:05 +02:00
|
|
|
ifeq ($(HAVE_PYTHON), 1)
|
|
|
|
DEFINES += $(PYTHON_CFLAGS) -Wno-unused-parameter
|
|
|
|
LIBS += $(PYTHON_LIBS)
|
|
|
|
OBJ += gfx/py_state/py_state.o
|
|
|
|
endif
|
|
|
|
|
2012-02-23 23:53:18 +01:00
|
|
|
ifeq ($(HAVE_SINC), 1)
|
|
|
|
OBJ += audio/sinc.o
|
|
|
|
else
|
|
|
|
OBJ += audio/hermite.o
|
|
|
|
endif
|
|
|
|
|
2011-01-10 17:15:27 +01:00
|
|
|
ifneq ($(V),1)
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
2011-10-07 17:43:39 +02:00
|
|
|
OPTIMIZE_FLAG = -O3
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
OPTIMIZE_FLAG = -O0
|
|
|
|
endif
|
|
|
|
|
2012-04-16 20:38:25 +02:00
|
|
|
CFLAGS += -Wall -Wno-unused-result $(OPTIMIZE_FLAG) -g -I. -pedantic
|
2011-12-24 13:46:12 +01:00
|
|
|
ifeq ($(CXX_BUILD), 1)
|
2011-12-25 01:45:09 +01:00
|
|
|
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
|
2011-12-24 13:46:12 +01:00
|
|
|
else
|
2011-03-16 21:48:44 +01:00
|
|
|
ifneq ($(findstring icc,$(CC)),)
|
2011-10-07 17:43:39 +02:00
|
|
|
CFLAGS += -std=c99 -D_GNU_SOURCE
|
2011-03-16 21:48:44 +01:00
|
|
|
else
|
|
|
|
CFLAGS += -std=gnu99
|
|
|
|
endif
|
2011-12-24 13:46:12 +01:00
|
|
|
endif
|
2010-05-26 21:27:37 +02:00
|
|
|
|
2010-12-30 02:56:56 +01:00
|
|
|
all: $(TARGET) config.mk
|
|
|
|
|
|
|
|
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
|
|
|
|
2012-04-21 23:13:50 +02:00
|
|
|
retroarch: $(OBJ)
|
2011-08-24 16:24:58 +02:00
|
|
|
$(Q)$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2011-01-10 17:15:27 +01:00
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2010-06-27 15:46:23 +02:00
|
|
|
|
2012-04-21 23:13:50 +02:00
|
|
|
tools/retroarch-joyconfig: $(JOYCONFIG_OBJ)
|
2011-12-24 13:46:12 +01:00
|
|
|
ifeq ($(CXX_BUILD), 1)
|
|
|
|
$(Q)$(CXX) -o $@ $(JOYCONFIG_OBJ) $(SDL_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
|
|
|
else
|
2011-08-24 16:24:58 +02:00
|
|
|
$(Q)$(CC) -o $@ $(JOYCONFIG_OBJ) $(SDL_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
|
2011-12-24 13:46:12 +01:00
|
|
|
endif
|
2011-01-10 17:15:27 +01:00
|
|
|
@$(if $(Q), $(shell echo echo LD $@),)
|
2011-01-09 15:58:49 +01:00
|
|
|
|
2011-01-10 15:01:34 +01:00
|
|
|
%.o: %.c config.h config.mk $(HEADERS)
|
2011-01-10 17:15:27 +01:00
|
|
|
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
|
|
|
|
@$(if $(Q), $(shell echo echo CC $<),)
|
2010-05-28 14:04:50 +02:00
|
|
|
|
|
|
|
install: $(TARGET)
|
2011-05-19 15:40:39 +02:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
|
|
|
|
mkdir -p $(DESTDIR)/etc 2>/dev/null || /bin/true
|
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 2>/dev/null || /bin/true
|
2011-01-05 20:47:31 +01:00
|
|
|
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
|
2012-04-21 23:31:57 +02:00
|
|
|
install -m644 retroarch.cfg $(DESTDIR)/etc/retroarch.cfg
|
|
|
|
install -m644 docs/retroarch.1 $(DESTDIR)$(PREFIX)/share/man/man1
|
|
|
|
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(PREFIX)/share/man/man1
|
|
|
|
install -m755 retroarch-zip $(DESTDIR)$(PREFIX)/bin
|
2010-05-28 14:04:50 +02:00
|
|
|
|
2011-01-09 15:58:49 +01:00
|
|
|
uninstall:
|
2012-04-21 23:31:57 +02:00
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-zip
|
|
|
|
rm -f $(DESTDIR)/etc/retroarch.cfg
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch.1
|
|
|
|
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-joyconfig.1
|
2010-05-26 21:27:37 +02:00
|
|
|
|
|
|
|
clean:
|
2010-08-19 20:29:32 +02:00
|
|
|
rm -f *.o
|
2010-12-24 11:53:43 +01:00
|
|
|
rm -f audio/*.o
|
2010-12-29 19:43:17 +01:00
|
|
|
rm -f conf/*.o
|
2010-12-24 11:53:43 +01:00
|
|
|
rm -f gfx/*.o
|
2011-06-09 13:56:29 +02:00
|
|
|
rm -f gfx/py_state/*.o
|
2011-01-06 18:34:11 +01:00
|
|
|
rm -f record/*.o
|
2011-01-10 17:20:08 +01:00
|
|
|
rm -f input/*.o
|
2011-01-09 15:58:49 +01:00
|
|
|
rm -f tools/*.o
|
2010-08-19 20:29:32 +02:00
|
|
|
rm -f $(TARGET)
|
2010-06-27 15:46:23 +02:00
|
|
|
|
|
|
|
.PHONY: all install uninstall clean
|