Compile to obj directories.

Avoids cluttering the main dir with objects.
This commit is contained in:
Themaister 2014-02-02 15:29:07 +01:00
parent d22999ab14
commit 564f743cc5
2 changed files with 52 additions and 71 deletions

View File

@ -2,6 +2,8 @@ include config.mk
TARGET = retroarch tools/retroarch-joyconfig tools/retrolaunch/retrolaunch
OBJDIR := obj-unix
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
retroarch.o \
@ -395,6 +397,9 @@ ifneq ($(GIT_VERSION),)
OBJ += git_version.o
endif
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
RARCH_JOYCONFIG_OBJ := $(addprefix $(OBJDIR)/,$(JOYCONFIG_OBJ))
RARCH_RETROLAUNCH_OBJ := $(addprefix $(OBJDIR)/,$(RETROLAUNCH_OBJ))
all: $(TARGET) config.mk
@ -402,54 +407,61 @@ config.mk: configure qb/*
@echo "config.mk is outdated or non-existing. Run ./configure again."
@exit 1
retroarch: $(OBJ)
retroarch: $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LD) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(Q)$(LD) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
tools/retroarch-joyconfig: $(JOYCONFIG_OBJ)
tools/retroarch-joyconfig: $(RARCH_JOYCONFIG_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
ifeq ($(CXX_BUILD), 1)
$(Q)$(CXX) -o $@ $(JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(Q)$(CXX) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
else
$(Q)$(CC) -o $@ $(JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(Q)$(CC) -o $@ $(RARCH_JOYCONFIG_OBJ) $(JOYCONFIG_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
endif
tools/retrolaunch/retrolaunch: $(RETROLAUNCH_OBJ)
tools/retrolaunch/retrolaunch: $(RARCH_RETROLAUNCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LD) -o $@ $(RETROLAUNCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(Q)$(LD) -o $@ $(RARCH_RETROLAUNCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
%.o: %.c config.h config.mk $(HEADERS)
$(OBJDIR)/%.o: %.c config.h config.mk $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
.FORCE:
git_version.o: git_version.c .FORCE
$(OBJDIR)/git_version.o: git_version.c .FORCE
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
tools/linuxraw_joypad.o: input/linuxraw_joypad.c $(HEADERS)
$(OBJDIR)/tools/linuxraw_joypad.o: input/linuxraw_joypad.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
tools/udev_joypad.o: input/udev_joypad.c $(HEADERS)
$(OBJDIR)/tools/udev_joypad.o: input/udev_joypad.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
tools/input_common_launch.o: input/input_common.c $(HEADERS)
$(OBJDIR)/tools/input_common_launch.o: input/input_common.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_RETROLAUNCH -c -o $@ $<
tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
%.o: %.S config.h config.mk $(HEADERS)
$(OBJDIR)/%.o: %.S config.h config.mk $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo AS $<),)
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
install: $(TARGET)
rm -f git_version.o
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
@ -472,27 +484,9 @@ uninstall:
rm -f $(DESTDIR)$(PREFIX)/share/pixmaps/retroarch.png
clean:
rm -f *.o
rm -f frontend/menu/*.o
rm -f frontend/menu/disp/*.o
rm -f frontend/*.o
rm -f audio/*.o
rm -f conf/*.o
rm -f camera/*.o
rm -f gfx/*.o
rm -f gfx/glsym/*.o
rm -f gfx/rpng/*.o
rm -f gfx/fonts/*.o
rm -f gfx/math/*.o
rm -f gfx/context/*.o
rm -f gfx/py_state/*.o
rm -f gfx/scaler/*.o
rm -f compat/*.o
rm -f compat/rxml/*.o
rm -f record/*.o
rm -f input/*.o
rm -f tools/*.o
rm -f tools/retrolaunch/*.o
rm -rf $(OBJDIR)
rm -f $(TARGET)
rm -f tools/retrolaunch/retrolaunch
rm -f tools/retroarch-joyconfig
.PHONY: all install uninstall clean

View File

@ -1,6 +1,8 @@
TARGET = retroarch.exe
JTARGET = tools/retroarch-joyconfig.exe
OBJDIR := obj-w32
OBJ = frontend/frontend.o \
frontend/frontend_context.o \
retroarch.o \
@ -272,69 +274,54 @@ ifneq ($(GIT_VERSION),)
OBJ += git_version.o
endif
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
RARCH_JOBJ := $(addprefix $(OBJDIR)/,$(JOBJ))
all: $(TARGET) $(JTARGET)
$(TARGET): $(OBJ)
$(TARGET): $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(CXX) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
$(Q)$(CXX) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LDCXXFLAGS)
%.o: %.c $(HEADERS)
$(OBJDIR)/%.o: %.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
.FORCE:
git_version.o: git_version.c .FORCE
$(OBJDIR)/git_version.o: git_version.c .FORCE
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
$(OBJDIR)/tools/input_common_joyconfig.o: input/input_common.c $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -DIS_JOYCONFIG -c -o $@ $<
%.o: %.cpp $(HEADERS)
$(OBJDIR)/%.o: %.cpp $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CXXFLAGS) $(DEFINES) -c -o $@ $<
%.o: %.rc $(HEADERS)
$(OBJDIR)/%.o: %.rc $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo WINDRES $<),)
$(Q)$(WINDRES) -o $@ $<
$(JTARGET): $(JOBJ)
$(JTARGET): $(RARCH_JOBJ)
@$(if $(Q), $(shell echo echo LD $@),)
ifeq ($(CXX_BUILD), 1)
$(Q)$(CXX) -o $@ $(JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
$(Q)$(CXX) -o $@ $(RARCH_JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
else
$(Q)$(CC) -o $@ $(JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
$(Q)$(CC) -o $@ $(RARCH_JOBJ) -ldxguid -ldinput8 -lole32 $(LDFLAGS) $(JLIBS)
endif
clean:
rm -f *.o
rm -f deps/miniz/*.o
rm -f frontend/*.o
rm -f frontend/menu/*.o
rm -f frontend/menu/disp/*.o
rm -f audio/*.o
rm -f audio/xaudio-c/*.o
rm -f compat/*.o
rm -f compat/rxml/*.o
rm -f conf/*.o
rm -f gfx/scaler/*.o
rm -f gfx/*.o
rm -f gfx/glsym/*.o
rm -f gfx/d3d9/*.o
rm -f gfx/context/*.o
rm -f gfx/math/*.o
rm -f gfx/fonts/*.o
rm -f gfx/py_state/*.o
rm -f gfx/rpng/*.o
rm -f record/*.o
rm -f input/*.o
rm -f input/autoconf/*.o
rm -f media/*.o
rm -rf $(OBJDIR)
rm -f $(TARGET)
rm -f retroarch-joyconfig.exe
rm -f tools/*.o
rm -f tools/retroarch-joyconfig.exe
dist_x86: all
zip -r retroarch-win32-1.0.zip $(TARGET) $(JTARGET) retroarch.cfg