Makefile: fix various issues

* Add missing dependency between shippable binaries and fixheader
* Remove spam when fixheader is used
* Remove error message on from clean
* Fix minimal rebuilds
* Use strict variables to avoid shelling out so often for file lists
* Reenable RALint checking of mods

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
This commit is contained in:
Chris Forbes
2011-07-07 22:48:31 +12:00
committed by Paul Chote
parent cd63da85d8
commit d95b579ead

View File

@@ -7,25 +7,24 @@ PHONY = core tools package all mods clean distclean
.SUFFIXES: .SUFFIXES:
core: game renderers mod_ra mod_cnc utility core: game renderers mod_ra mod_cnc utility
tools: editor ralint seqed filex tsbuild tools: editor ralint seqed filex tsbuild
package: fixheader core editor package: core editor
mods: mod_ra mod_cnc mods: mod_ra mod_cnc
all: core tools all: core tools
clean: clean:
@-rm *.exe *.dll *.mdb mods/**/*.dll mods/**/*.mdb *.resources @-rm -f *.exe *.dll *.mdb mods/**/*.dll mods/**/*.mdb *.resources
distclean: clean distclean: clean
# #
# Core binaries # Core binaries
# #
fileformats_SRCS = $(shell find OpenRA.FileFormats/ -iname '*.cs') fileformats_SRCS := $(shell find OpenRA.FileFormats/ -iname '*.cs')
fileformats_TARGET = OpenRA.FileFormats.dll fileformats_TARGET = OpenRA.FileFormats.dll
#fileformats_DEPS = fixheader
fileformats_KIND = library fileformats_KIND = library
fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Forms.dll fileformats_LIBS = $(COMMON_LIBS) thirdparty/Tao/Tao.Sdl.dll System.Windows.Forms.dll
PROGRAMS = fileformats PROGRAMS = fileformats
fileformats: $(fileformats_TARGET) fileformats: $(fileformats_TARGET)
game_SRCS = $(shell find OpenRA.Game/ -iname '*.cs') game_SRCS := $(shell find OpenRA.Game/ -iname '*.cs')
game_TARGET = OpenRA.Game.exe game_TARGET = OpenRA.Game.exe
game_KIND = winexe game_KIND = winexe
game_DEPS = $(fileformats_TARGET) game_DEPS = $(fileformats_TARGET)
@@ -38,7 +37,7 @@ game: $(game_TARGET)
# #
# Renderer dlls # Renderer dlls
# #
rcg_SRCS = $(shell find OpenRA.Renderer.Cg/ -iname '*.cs') rcg_SRCS := $(shell find OpenRA.Renderer.Cg/ -iname '*.cs')
rcg_TARGET = OpenRA.Renderer.Cg.dll rcg_TARGET = OpenRA.Renderer.Cg.dll
rcg_KIND = library rcg_KIND = library
rcg_DEPS = $(fileformats_TARGET) $(game_TARGET) rcg_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -46,7 +45,7 @@ rcg_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \ thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \
$(rcg_DEPS) $(game_TARGET) $(rcg_DEPS) $(game_TARGET)
rgl_SRCS = $(shell find OpenRA.Renderer.Gl/ -iname '*.cs') rgl_SRCS := $(shell find OpenRA.Renderer.Gl/ -iname '*.cs')
rgl_TARGET = OpenRA.Renderer.Gl.dll rgl_TARGET = OpenRA.Renderer.Gl.dll
rgl_KIND = library rgl_KIND = library
rgl_DEPS = $(fileformats_TARGET) $(game_TARGET) rgl_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -54,7 +53,7 @@ rgl_LIBS = $(COMMON_LIBS) System.Windows.Forms.dll \
thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \ thirdparty/Tao/Tao.Cg.dll thirdparty/Tao/Tao.OpenGl.dll thirdparty/Tao/Tao.Sdl.dll \
$(rgl_DEPS) $(game_TARGET) $(rgl_DEPS) $(game_TARGET)
rnull_SRCS = $(shell find OpenRA.Renderer.Null/ -iname '*.cs') rnull_SRCS := $(shell find OpenRA.Renderer.Null/ -iname '*.cs')
rnull_TARGET = OpenRA.Renderer.Null.dll rnull_TARGET = OpenRA.Renderer.Null.dll
rnull_KIND = library rnull_KIND = library
rnull_DEPS = $(fileformats_TARGET) $(game_TARGET) rnull_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -67,30 +66,34 @@ renderers: $(rcg_TARGET) $(rgl_TARGET) $(rnull_TARGET)
# Official Mods # Official Mods
# #
# Red Alert # Red Alert
mod_ra_SRCS = $(shell find OpenRA.Mods.RA/ -iname '*.cs')
STD_MOD_LIBS = $(fileformats_TARGET) $(game_TARGET)
STD_MOD_DEPS = $(STD_MOD_LIBS) $(ralint_TARGET)
mod_ra_SRCS := $(shell find OpenRA.Mods.RA/ -iname '*.cs')
mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll mod_ra_TARGET = mods/ra/OpenRA.Mods.RA.dll
mod_ra_KIND = library mod_ra_KIND = library
mod_ra_DEPS = $(fileformats_TARGET) $(game_TARGET) mod_ra_DEPS = $(STD_MOD_DEPS)
mod_ra_LIBS = $(COMMON_LIBS) $(mod_ra_DEPS) mod_ra_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS)
mod_ra_EXTRA_CMDS = mono RALint.exe ra
PROGRAMS += mod_ra PROGRAMS += mod_ra
mod_ra: $(mod_ra_TARGET) mod_ra: $(mod_ra_TARGET)
# mono RALint.exe ra
# Command and Conquer # Command and Conquer
mod_cnc_SRCS = $(shell find OpenRA.Mods.Cnc/ -iname '*.cs') mod_cnc_SRCS := $(shell find OpenRA.Mods.Cnc/ -iname '*.cs')
mod_cnc_TARGET = mods/cnc/OpenRA.Mods.Cnc.dll mod_cnc_TARGET = mods/cnc/OpenRA.Mods.Cnc.dll
mod_cnc_KIND = library mod_cnc_KIND = library
mod_cnc_DEPS = $(fileformats_TARGET) $(game_TARGET) $(mod_ra_TARGET) mod_cnc_DEPS = $(STD_MOD_DEPS) $(mod_ra_TARGET)
mod_cnc_LIBS = $(COMMON_LIBS) $(mod_cnc_DEPS) mod_cnc_LIBS = $(COMMON_LIBS) $(STD_MOD_LIBS) $(mod_ra_TARGET)
mod_cnc_EXTRA_CMDS = mono RALint.exe cnc
PROGRAMS += mod_cnc PROGRAMS += mod_cnc
mod_cnc: $(mod_cnc_TARGET) mod_cnc: $(mod_cnc_TARGET)
# mono RALint.exe cnc
# #
# Tools # Tools
# #
# Sequence editor (defunct) # Sequence editor (defunct)
seqed_SRCS = $(shell find SequenceEditor/ -iname '*.cs') seqed_SRCS := $(shell find SequenceEditor/ -iname '*.cs')
seqed_TARGET = SequenceEditor.exe seqed_TARGET = SequenceEditor.exe
seqed_KIND = winexe seqed_KIND = winexe
seqed_DEPS = $(fileformats_TARGET) seqed_DEPS = $(fileformats_TARGET)
@@ -102,7 +105,7 @@ SequenceEditor.Form1.resources:
seqed: SequenceEditor.Form1.resources $(seqed_TARGET) seqed: SequenceEditor.Form1.resources $(seqed_TARGET)
# Map Editor # Map Editor
editor_SRCS = $(shell find OpenRA.Editor/ -iname '*.cs') editor_SRCS := $(shell find OpenRA.Editor/ -iname '*.cs')
editor_TARGET = OpenRA.Editor.exe editor_TARGET = OpenRA.Editor.exe
editor_KIND = winexe editor_KIND = winexe
editor_DEPS = $(fileformats_TARGET) $(game_TARGET) editor_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -118,7 +121,7 @@ OpenRA.Editor.Form1.resources:
editor: OpenRA.Editor.MapSelect.resources OpenRA.Editor.Form1.resources $(editor_TARGET) editor: OpenRA.Editor.MapSelect.resources OpenRA.Editor.Form1.resources $(editor_TARGET)
# Analyses mod yaml for easy to detect errors # Analyses mod yaml for easy to detect errors
ralint_SRCS = $(shell find RALint/ -iname '*.cs') ralint_SRCS := $(shell find RALint/ -iname '*.cs')
ralint_TARGET = RALint.exe ralint_TARGET = RALint.exe
ralint_KIND = exe ralint_KIND = exe
ralint_DEPS = $(fileformats_TARGET) $(game_TARGET) ralint_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -127,7 +130,7 @@ PROGRAMS += ralint
ralint: $(ralint_TARGET) ralint: $(ralint_TARGET)
# Extracts files from packages (mixfiles, zips, etc) # Extracts files from packages (mixfiles, zips, etc)
filex_SRCS = $(shell find FileExtractor/ -iname '*.cs') filex_SRCS := $(shell find FileExtractor/ -iname '*.cs')
filex_TARGET = FileExtractor.exe filex_TARGET = FileExtractor.exe
filex_KIND = exe filex_KIND = exe
filex_DEPS = $(fileformats_TARGET) filex_DEPS = $(fileformats_TARGET)
@@ -136,7 +139,7 @@ PROGRAMS += filex
filex: $(filex_TARGET) filex: $(filex_TARGET)
# Builds and exports tilesets from a bitmap # Builds and exports tilesets from a bitmap
tsbuild_SRCS = $(shell find OpenRA.TilesetBuilder/ -iname '*.cs') tsbuild_SRCS := $(shell find OpenRA.TilesetBuilder/ -iname '*.cs')
tsbuild_TARGET = TilesetBuilder.exe tsbuild_TARGET = TilesetBuilder.exe
tsbuild_KIND = winexe tsbuild_KIND = winexe
tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET) tsbuild_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -151,12 +154,12 @@ tsbuild: OpenRA.TilesetBuilder.Form1.resources $(tsbuild_TARGET)
# Launchers / Utilities # Launchers / Utilities
# #
# Patches binary headers to work around a mono bug # Patches binary headers to work around a mono bug
fixheader: packaging/fixheader.cs fixheader.exe: packaging/fixheader.cs
@echo CSC fixheader.exe
@$(CSC) packaging/fixheader.cs $(CSFLAGS) -out:fixheader.exe -t:exe $(COMMON_LIBS:%=-r:%) @$(CSC) packaging/fixheader.cs $(CSFLAGS) -out:fixheader.exe -t:exe $(COMMON_LIBS:%=-r:%)
PHONY += fixheader
# Backend for the launcher apps - queries game/mod info and applies actions to an install # Backend for the launcher apps - queries game/mod info and applies actions to an install
utility_SRCS = $(shell find OpenRA.Utility/ -iname '*.cs') utility_SRCS := $(shell find OpenRA.Utility/ -iname '*.cs')
utility_TARGET = OpenRA.Utility.exe utility_TARGET = OpenRA.Utility.exe
utility_KIND = exe utility_KIND = exe
utility_DEPS = $(fileformats_TARGET) $(game_TARGET) utility_DEPS = $(fileformats_TARGET) $(game_TARGET)
@@ -171,7 +174,7 @@ utility: $(utility_TARGET)
# #
define BUILD_ASSEMBLY define BUILD_ASSEMBLY
$$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS) $$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS) fixheader.exe
@echo CSC $$(@) @echo CSC $$(@)
@$(CSC) $$($(1)_LIBS:%=-r:%) \ @$(CSC) $$($(1)_LIBS:%=-r:%) \
-out:$$(@) $(CSFLAGS) $$($(1)_FLAGS) \ -out:$$(@) $(CSFLAGS) $$($(1)_FLAGS) \
@@ -179,8 +182,9 @@ $$($(1)_TARGET): $$($(1)_SRCS) Makefile $$($(1)_DEPS)
-t:"$$($(1)_KIND)" \ -t:"$$($(1)_KIND)" \
$$($(1)_EXTRA) \ $$($(1)_EXTRA) \
$$($(1)_SRCS) $$($(1)_SRCS)
@test -e fixheader.exe && mono fixheader.exe $$(@) || `` @mono fixheader.exe $$(@) > /dev/null
@test `echo $$(@) | sed 's/^.*\.//'` = "dll" && chmod a-x $$(@) || `` @test `echo $$(@) | sed 's/^.*\.//'` = "dll" && chmod a-x $$(@) || ``
@$$($(1)_EXTRA_CMDS)
endef endef
$(foreach prog,$(PROGRAMS),$(eval $(call BUILD_ASSEMBLY,$(prog)))) $(foreach prog,$(PROGRAMS),$(eval $(call BUILD_ASSEMBLY,$(prog))))