2020# make check-sdk-scripts
2121# make check-packaging-scripts
2222
23- .PHONY : utility stylecheck build clean engine version check check-scripts check- sdk-scripts check-packaging-scripts check-variables
23+ .PHONY : check- sdk-scripts check-packaging-scripts check-variables engine all clean version check-scripts check test
2424.DEFAULT_GOAL := all
2525
2626PYTHON = $(shell command -v python3 2> /dev/null)
@@ -48,8 +48,19 @@ MOD_SOLUTION_FILES = $(shell find . -maxdepth 1 -iname '*.sln' 2> /dev/null)
4848
4949MSBUILD = msbuild -verbosity:m -nologo
5050
51- # Enable 32 bit builds while generating the windows installer
52- WIN32 = false
51+ ifndef TARGETPLATFORM
52+ UNAME_S := $(shell uname -s)
53+ UNAME_M := $(shell uname -m)
54+ ifeq ($(UNAME_S ) ,Darwin)
55+ TARGETPLATFORM = osx-x64
56+ else
57+ ifeq ($(UNAME_M ) ,x86_64)
58+ TARGETPLATFORM = linux-x64
59+ else
60+ TARGETPLATFORM = unix-generic
61+ endif
62+ endif
63+ endif
5364
5465check-sdk-scripts :
5566 @awk ' /\r$$/ { exit(1); }' mod.config || (printf " Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n" ; exit 1)
@@ -110,43 +121,25 @@ check-variables:
110121 exit 1; \
111122 fi
112123
113- engine-dependencies : check-variables check-sdk-scripts
114- @./fetch-engine.sh || (printf " Unable to continue without engine files\n" ; exit 1)
115- @cd $(ENGINE_DIRECTORY ) && make dependencies WIN32=$(WIN32 )
116-
117124engine : check-variables check-sdk-scripts
118125 @./fetch-engine.sh || (printf " Unable to continue without engine files\n" ; exit 1)
119- @cd $(ENGINE_DIRECTORY ) && make core WIN32=$(WIN32 )
120-
121- utility : engine-dependencies engine
122- @test -f " $( ENGINE_DIRECTORY) /OpenRA.Utility.exe" || (printf " OpenRA.Utility.exe not found!\n" ; exit 1)
126+ @cd $(ENGINE_DIRECTORY ) && make TARGETPLATFORM=$(TARGETPLATFORM ) all
123127
124- core :
125- @command -v $(MSBUILD ) > /dev/null || (echo " OpenRA requires the '$( MSBUILD) ' tool provided by Mono >= 5.4 ." ; exit 1)
128+ all : engine
129+ @command -v $(MSBUILD ) > /dev/null || (echo " OpenRA requires the '$( MSBUILD) ' tool provided by Mono >= 5.18 ." ; exit 1)
126130ifneq ("$(MOD_SOLUTION_FILES ) ","")
127- @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:restore \;
128- ifeq ($(WIN32 ) , $(filter $(WIN32 ) ,true yes y on 1) )
129- @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration="Release-x86" \;
130- else
131- @$(MSBUILD) -t:build -p:Configuration=Release
132- @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration=Release \;
131+ @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Release -p:TargetPlatform=$(TARGETPLATFORM) \;
133132endif
134- endif
135-
136- all : engine-dependencies engine core
137133
138134clean : engine
139- @command -v $(MSBUILD ) > /dev/null || (echo " OpenRA requires the '$( MSBUILD) ' tool provided by Mono >= 5.4 ." ; exit 1)
135+ @command -v $(MSBUILD ) > /dev/null || (echo " OpenRA requires the '$( MSBUILD) ' tool provided by Mono >= 5.18 ." ; exit 1)
140136ifneq ("$(MOD_SOLUTION_FILES ) ","")
141137 @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \;
142138endif
143139 @cd $(ENGINE_DIRECTORY) && make clean
144- @printf "The engine has been cleaned.\n"
145140
146141version : check-variables
147- @awk ' {sub("Version:.*$$","Version: $(VERSION)"); print $0}' $(MANIFEST_PATH ) > $(MANIFEST_PATH ) .tmp && \
148- awk ' {sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $(MANIFEST_PATH ) .tmp > $(MANIFEST_PATH ) && \
149- rm $(MANIFEST_PATH ) .tmp
142+ @sh -c ' . $(ENGINE_DIRECTORY)/packaging/functions.sh; set_mod_version $(VERSION) $(MANIFEST_PATH)'
150143 @printf " Version changed to $( VERSION) .\n"
151144
152145check-scripts : check-variables
@@ -159,18 +152,18 @@ ifneq ("$(LUA_FILES)","")
159152 @luac -p $(LUA_FILES)
160153endif
161154
162- check : utility
155+ check : engine
163156ifneq ("$(MOD_SOLUTION_FILES ) ","")
164157 @echo "Compiling in debug mode..."
165- @$(MSBUILD) -t:build - p:Configuration=Debug
158+ @find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore - p:Configuration=Debug -p:TargetPlatform=$(TARGETPLATFORM) \;
166159endif
167160 @echo "Checking runtime assemblies..."
168- @MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
161+ @./utility.sh --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
169162 @echo "Checking for explicit interface violations..."
170- @MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-explicit-interfaces
163+ @./utility.sh --check-explicit-interfaces
171164 @echo "Checking for incorrect conditional trait interface overrides..."
172- @MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-conditional-trait-interface-overrides
165+ @./utility.sh --check-conditional-trait-interface-overrides
173166
174- test : utility
167+ test : all
175168 @echo " Testing $( MOD_ID) mod MiniYAML..."
176- @MOD_SEARCH_PATHS= " $( MOD_SEARCH_PATHS ) " mono --debug " $( ENGINE_DIRECTORY ) /OpenRA.Utility.exe " $( MOD_ID ) --check-yaml
169+ @./utility.sh --check-yaml
0 commit comments