diff --git a/bsnes/GNUmakefile b/bsnes/GNUmakefile index 9450f39ce..8a320cdf6 100644 --- a/bsnes/GNUmakefile +++ b/bsnes/GNUmakefile @@ -1,9 +1,11 @@ +srcdir := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) + target := bsnes binary := application build := performance openmp := true local := true -flags += -I. -I.. +flags += -I$(srcdir)/. -I$(srcdir)/.. # in order for this to work, obj/lzma.o must be omitted or bsnes will hang on startup. # further, only the X-Video driver works reliably. OpenGL 3.2, OpenGL 2.0, and XShm crash bsnes. @@ -17,7 +19,7 @@ ifeq ($(local),true) flags += -march=native endif -nall.path := ../nall +nall.path := $(srcdir)/../nall include $(nall.path)/GNUmakefile ifeq ($(platform),windows) @@ -46,16 +48,16 @@ endif objects := libco emulator filter lzma -obj/libco.o: ../libco/libco.c -obj/emulator.o: emulator/emulator.cpp -obj/filter.o: filter/filter.cpp -obj/lzma.o: lzma/lzma.cpp +obj/libco.o: $(srcdir)/../libco/libco.c maketree +obj/emulator.o: $(srcdir)/emulator/emulator.cpp maketree +obj/filter.o: $(srcdir)/filter/filter.cpp maketree +obj/lzma.o: $(srcdir)/lzma/lzma.cpp maketree -include sfc/GNUmakefile -include gb/GNUmakefile -include processor/GNUmakefile +include $(srcdir)/sfc/GNUmakefile +include $(srcdir)/gb/GNUmakefile +include $(srcdir)/processor/GNUmakefile -ui := target-$(target) +ui := $(srcdir)/target-$(target) include $(ui)/GNUmakefile -include obj/*.d diff --git a/bsnes/gb/GNUmakefile b/bsnes/gb/GNUmakefile index b94dfa0c8..2a43b5893 100644 --- a/bsnes/gb/GNUmakefile +++ b/bsnes/gb/GNUmakefile @@ -6,21 +6,21 @@ objects += gb-memory gb-printer gb-random gb-rewind gb-save_state gb-sgb objects += gb-sm83_cpu gb-symbol_hash gb-timing #objects+= gb-debugger gb-sm83_disassembler -obj/gb-apu.o: gb/Core/apu.c -obj/gb-camera.o: gb/Core/camera.c -obj/gb-debugger.o: gb/Core/debugger.c -obj/gb-rumble.o: gb/Core/rumble.c -obj/gb-display.o: gb/Core/display.c -obj/gb-gb.o: gb/Core/gb.c -obj/gb-joypad.o: gb/Core/joypad.c -obj/gb-mbc.o: gb/Core/mbc.c -obj/gb-memory.o: gb/Core/memory.c -obj/gb-printer.o: gb/Core/printer.c -obj/gb-random.o: gb/Core/random.c -obj/gb-rewind.o: gb/Core/rewind.c -obj/gb-save_state.o: gb/Core/save_state.c -obj/gb-sgb.o: gb/Core/sgb.c -obj/gb-sm83_cpu.o: gb/Core/sm83_cpu.c -obj/gb-sm83_disassembler.o: gb/Core/sm83_disassembler.c -obj/gb-symbol_hash.o: gb/Core/symbol_hash.c -obj/gb-timing.o: gb/Core/timing.c +obj/gb-apu.o: $(srcdir)/gb/Core/apu.c +obj/gb-camera.o: $(srcdir)/gb/Core/camera.c +obj/gb-debugger.o: $(srcdir)/gb/Core/debugger.c +obj/gb-rumble.o: $(srcdir)/gb/Core/rumble.c +obj/gb-display.o: $(srcdir)/gb/Core/display.c +obj/gb-gb.o: $(srcdir)/gb/Core/gb.c +obj/gb-joypad.o: $(srcdir)/gb/Core/joypad.c +obj/gb-mbc.o: $(srcdir)/gb/Core/mbc.c +obj/gb-memory.o: $(srcdir)/gb/Core/memory.c +obj/gb-printer.o: $(srcdir)/gb/Core/printer.c +obj/gb-random.o: $(srcdir)/gb/Core/random.c +obj/gb-rewind.o: $(srcdir)/gb/Core/rewind.c +obj/gb-save_state.o: $(srcdir)/gb/Core/save_state.c +obj/gb-sgb.o: $(srcdir)/gb/Core/sgb.c +obj/gb-sm83_cpu.o: $(srcdir)/gb/Core/sm83_cpu.c +obj/gb-sm83_disassembler.o: $(srcdir)/gb/Core/sm83_disassembler.c +obj/gb-symbol_hash.o: $(srcdir)/gb/Core/symbol_hash.c +obj/gb-timing.o: $(srcdir)/gb/Core/timing.c diff --git a/bsnes/processor/GNUmakefile b/bsnes/processor/GNUmakefile index e8928ebf5..5dda56ca8 100644 --- a/bsnes/processor/GNUmakefile +++ b/bsnes/processor/GNUmakefile @@ -8,10 +8,10 @@ objects += $(if $(findstring spc700,$(processors)),processor-spc700) objects += $(if $(findstring upd96050,$(processors)),processor-upd96050) objects += $(if $(findstring wdc65816,$(processors)),processor-wdc65816) -obj/processor-arm7tdmi.o: processor/arm7tdmi/arm7tdmi.cpp -obj/processor-gsu.o: processor/gsu/gsu.cpp -obj/processor-hg51b.o: processor/hg51b/hg51b.cpp -obj/processor-sm83.o: processor/sm83/sm83.cpp -obj/processor-spc700.o: processor/spc700/spc700.cpp -obj/processor-upd96050.o: processor/upd96050/upd96050.cpp -obj/processor-wdc65816.o: processor/wdc65816/wdc65816.cpp +obj/processor-arm7tdmi.o: $(srcdir)/processor/arm7tdmi/arm7tdmi.cpp +obj/processor-gsu.o: $(srcdir)/processor/gsu/gsu.cpp +obj/processor-hg51b.o: $(srcdir)/processor/hg51b/hg51b.cpp +obj/processor-sm83.o: $(srcdir)/processor/sm83/sm83.cpp +obj/processor-spc700.o: $(srcdir)/processor/spc700/spc700.cpp +obj/processor-upd96050.o: $(srcdir)/processor/upd96050/upd96050.cpp +obj/processor-wdc65816.o: $(srcdir)/processor/wdc65816/wdc65816.cpp diff --git a/bsnes/sfc/GNUmakefile b/bsnes/sfc/GNUmakefile index 3bbd74832..1eedfae28 100644 --- a/bsnes/sfc/GNUmakefile +++ b/bsnes/sfc/GNUmakefile @@ -5,18 +5,18 @@ objects += sfc-cartridge sfc-memory objects += sfc-cpu sfc-smp sfc-dsp sfc-ppu sfc-ppu-fast objects += sfc-expansion sfc-coprocessor sfc-slot -obj/sfc-interface.o: sfc/interface/interface.cpp -obj/sfc-system.o: sfc/system/system.cpp -obj/sfc-controller.o: sfc/controller/controller.cpp -obj/sfc-cartridge.o: sfc/cartridge/cartridge.cpp -obj/sfc-memory.o: sfc/memory/memory.cpp +obj/sfc-interface.o: $(srcdir)/sfc/interface/interface.cpp maketree +obj/sfc-system.o: $(srcdir)/sfc/system/system.cpp maketree +obj/sfc-controller.o: $(srcdir)/sfc/controller/controller.cpp maketree +obj/sfc-cartridge.o: $(srcdir)/sfc/cartridge/cartridge.cpp maketree +obj/sfc-memory.o: $(srcdir)/sfc/memory/memory.cpp maketree -obj/sfc-cpu.o: sfc/cpu/cpu.cpp -obj/sfc-smp.o: sfc/smp/smp.cpp -obj/sfc-dsp.o: sfc/dsp/dsp.cpp -obj/sfc-ppu.o: sfc/ppu/ppu.cpp -obj/sfc-ppu-fast.o: sfc/ppu-fast/ppu.cpp +obj/sfc-cpu.o: $(srcdir)/sfc/cpu/cpu.cpp maketree +obj/sfc-smp.o: $(srcdir)/sfc/smp/smp.cpp maketree +obj/sfc-dsp.o: $(srcdir)/sfc/dsp/dsp.cpp maketree +obj/sfc-ppu.o: $(srcdir)/sfc/ppu/ppu.cpp maketree +obj/sfc-ppu-fast.o: $(srcdir)/sfc/ppu-fast/ppu.cpp maketree -obj/sfc-expansion.o: sfc/expansion/expansion.cpp -obj/sfc-coprocessor.o: sfc/coprocessor/coprocessor.cpp -obj/sfc-slot.o: sfc/slot/slot.cpp +obj/sfc-expansion.o: $(srcdir)/sfc/expansion/expansion.cpp maketree +obj/sfc-coprocessor.o: $(srcdir)/sfc/coprocessor/coprocessor.cpp maketree +obj/sfc-slot.o: $(srcdir)/sfc/slot/slot.cpp maketree diff --git a/bsnes/target-bsnes/GNUmakefile b/bsnes/target-bsnes/GNUmakefile index 6c9058a13..e14782599 100644 --- a/bsnes/target-bsnes/GNUmakefile +++ b/bsnes/target-bsnes/GNUmakefile @@ -1,10 +1,10 @@ name := bsnes -hiro.path := ../hiro +hiro.path := $(srcdir)/../hiro hiro.resource := $(ui)/resource/bsnes.rc include $(hiro.path)/GNUmakefile -ruby.path := ../ruby +ruby.path := $(srcdir)/../ruby include $(ruby.path)/GNUmakefile objects += ui-bsnes ui-program ui-input ui-presentation @@ -58,8 +58,8 @@ else ifneq ($(filter $(platform),linux bsd),) cp $(ui)/resource/$(name).desktop $(DESTDIR)$(datarootdir)/applications/$(name).desktop cp $(ui)/resource/$(name).png $(DESTDIR)$(datarootdir)/icons/hicolor/256x256/apps/$(name).png cp $(ui)/resource/$(name).svg $(DESTDIR)$(datarootdir)/icons/hicolor/scalable/apps/$(name).svg - cp Database/* $(DESTDIR)$(datadir)/$(name)/Database/ - cp -r ../shaders/* $(DESTDIR)$(datadir)/$(name)/Shaders/ + cp $(srcdir)/Database/* $(DESTDIR)$(datadir)/$(name)/Database/ + cp -r $(srcdir)/../shaders/* $(DESTDIR)$(datadir)/$(name)/Shaders/ endif uninstall: diff --git a/hiro/GNUmakefile b/hiro/GNUmakefile index 04837b274..f56c7b72e 100755 --- a/hiro/GNUmakefile +++ b/hiro/GNUmakefile @@ -66,13 +66,13 @@ hiro.objects := \ $(object.path)/hiro-$(hiro).o \ $(if $(filter windows,$(hiro)),$(object.path)/hiro-resource.o) -$(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp +$(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp maketree $(if $(filter qt%,$(hiro)),$(info Compiling $(hiro.path)/qt/qt.moc ...)) $(if $(filter qt%,$(hiro)),@$(moc) -i -o $(hiro.path)/qt/qt.moc $(hiro.path)/qt/qt.hpp) $(info Compiling $< ...) @$(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@ -$(object.path)/hiro-resource.o: $(hiro.resource) +$(object.path)/hiro-resource.o: $(hiro.resource) maketree $(info Compiling $< ...) @$(windres) $< $@ diff --git a/nall/GNUmakefile b/nall/GNUmakefile index dcca2b6dd..e3199281d 100755 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -155,6 +155,16 @@ endif # rules default: all; +maketree: $(object.path)/.tag out/.tag + +$(object.path)/.tag: + @mkdir -p obj + @touch $@ + +out/.tag: + @mkdir -p out + @touch $@ + nall.verbose: $(info Compiler Flags:) $(foreach n,$(sort $(call unique,$(flags))),$(if $(filter-out -I%,$n),$(info $([space]) $n))) diff --git a/ruby/GNUmakefile b/ruby/GNUmakefile index f27418b2f..bb0782152 100755 --- a/ruby/GNUmakefile +++ b/ruby/GNUmakefile @@ -71,7 +71,7 @@ endif ruby.objects := $(object.path)/ruby.o -$(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path)) +$(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path)) maketree $(info Compiling $< ...) @$(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@