PATH=/sbin:/bin:/usr/sbin:/usr/bin:/c/ProgramData/chocolatey/bin:$(SystemRoot)/System32/WindowsPowerShell/v1.0 mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) current_dir := $(patsubst %/,%,$(dir $(mkfile_path))) scriptFiles := $(patsubst Source/Scripts/%.psc,plugin/Data/Scripts/%.pex,$(wildcard Source/Scripts/*.psc)) textureFiles := $(patsubst Source/Textures/%.xcf,plugin/Data/Textures/%.dds,$(wildcard Source/Textures/_EQ_ItemRoulette/*.xcf)) modelFiles := $(patsubst Source/Meshes/%_mesh.blend,plugin/Data/Meshes/%_final.nif,$(wildcard Source/Meshes/_EQ_ItemRoulette/*_mesh.blend)) .ONESHELL: all: zip clean: rm -rf \ plugin/Data/Meshes \ plugin/Data/Scripts \ plugin/Data/Textures && true distclean: clean rm -rf build && true mkdir build zip: build/Item_Roulette_for_VRIK.zip build/Item_Roulette_for_VRIK.zip: plugin rm -rf "$@" powershell -Command 'Compress-Archive -Path "plugin/*" -DestinationPath "$@"' plugin: scripts models scripts: $(scriptFiles) plugin/Data/Scripts/%.pex: Source/Scripts/%.psc "$(SKYRIM_BASE)/Papyrus Compiler/PapyrusCompiler.exe" \ "$^" \ "-f=$(SKYRIM_BASE)/Data/Source/Scripts/TESV_Papyrus_Flags.flg" \ "-i=$(SKYRIM_BASE)/Data/Source/Scripts;Source/Scripts" \ "-o=$@" \ textures: $(textureFiles) GIMP=$$(powershell -Command '(Get-Item "$(ProgramW6432)/GIMP*/bin/gimp-console*.exe").FullName') "$$GIMP" -n -i --batch-interpreter python-fu-eval -b "import export_gimp_textures" models: $(modelFiles) build/ChunkMerge/ChunkMerge.exe: build/chunkmerge.7z 7z x -y "-obuild" "$<" build/chunkmerge.7z: powershell -Command 'Invoke-WebRequest -Uri "https://github.com/downloads/skyfox69/NifUtils/ChunkMerge0155.7z" -OutFile build/chunkmerge.7z' build/ChunkMerge/ChunkMerge.xml: build/ChunkMerge/ChunkMerge.exe cat > "$@" <<'HERE' $(SKYRIM_BASE) $(current_dir)/nif.xml $(current_dir)\\Source\\Meshes\\_EQ_ItemRoulette 0 0 1 1 1 -553455049 SkyrimHavokMaterial SKY_HAV_ Material Unknown 1 0 0 0 ffffffff ffffff00 ff200020 ffff00ff HERE plugin/Data/Meshes/_EQ_ItemRoulette/%_final.nif: Source/Meshes/_EQ_ItemRoulette/%_template.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif build/ChunkMerge/ChunkMerge.xml cp "$(filter %_mesh.nif,$^)" "$@" build/ChunkMerge/ChunkMerge.exe & powershell -Command '$$env:ChunkMerge_NifFile=Split-Path (Join-Path "$@" "."); $$env:ChunkMerge_CollisionFile=Split-Path (Join-Path "$(filter %_collision.nif,$^)" ".") ; $$env:ChunkMerge_TemplateFile="$(notdir $(filter %_template.nif,$^))" ; Start-Process -Wait -FilePath AutoHotKey -ArgumentList @("ChunkMerge.ahk") ; Stop-Process -Name ChunkMerge' plugin/Data/Meshes/_EQ_ItemRoulette/%_mesh.nif: Source/Meshes/_EQ_ItemRoulette/%_mesh.blend BLENDER=$$(powershell -Command '(Get-Item "$(ProgramW6432)/Blender*/Blender*/blender.exe").FullName') "$$BLENDER" --background --python "./export_blender_models.py" -- "$^" "$@" plugin/Data/Meshes/_EQ_ItemRoulette/%_collision.nif: Source/Meshes/_EQ_ItemRoulette/%_collision.blend BLENDER=$$(powershell -Command '(Get-Item "$(ProgramW6432)/Blender*/Blender*/blender.exe").FullName') "$$BLENDER" --background --python "./export_blender_models.py" -- "$^" "$@"