Makefile: Allow user to specify build name and add help target

This commit is contained in:
Andrew Eikum 2019-03-22 08:51:16 -05:00
parent e3ea6a2479
commit 9c312a13a8
2 changed files with 69 additions and 25 deletions

View File

@ -1,49 +1,89 @@
# "Quick start" Makefile targets:
# install - install Proton into current user's Steam installation
# deploy - build deployment files into tagged directory
#
# Development targts:
# vagrant - start Vagrant VM
# proton - build Proton
# module - build a single Wine module and copy into the shared directory.
# note: this is a development loop target. use it only after building all of wine with one of the other targets
# specify module variable: make module=kernel32 module
#See help target below for documentation
build_name := $(shell git symbolic-ref --short HEAD 2>/dev/null)-local
ifeq ($(build_name),)
$(error ERROR: Unable to auto-detect build name. Check out a branch or specify with "build_name=...")
endif
# remove special chars
override build_name := $(shell echo $(build_name) | tr -dc '[:alnum:] ._-')
STEAM_DIR := $(HOME)/.steam/root
DEPLOY_DIR := $(shell git describe --tags --always)
CONFIGURE_CMD := ../proton/configure.sh --steam-runtime64=docker:steam-proton-dev --steam-runtime32=docker:steam-proton-dev32 --steam-runtime="$$HOME"/steam-runtime/runtime/
CONFIGURE_CMD := ../proton/configure.sh --steam-runtime64=docker:steam-proton-dev --steam-runtime32=docker:steam-proton-dev32 --steam-runtime="$$HOME"/steam-runtime/runtime/ --build-name="$(build_name)"
all: proton
# make doesn't handle spaces well... replace them with underscores in paths
BUILD_DIR := "build-$(shell echo $(build_name) | sed -e 's/ /_/g')"
.PHONY: vagrant clean configure proton install deploy module
all: help
.PHONY: help vagrant clean configure proton install deploy module
help:
@echo "Proton Makefile instructions"
@echo ""
@echo ""Quick start" Makefile targets:"
@echo " install - Install Proton into current user's Steam installation"
@echo " deploy - Build deployment files into a directory in vagrant_share/ named"
@echo " after the nearest git tag"
@echo " clean - Delete the Proton build directory"
@echo ""
@echo "Configuration variables:"
@echo " build_name - The name of the build, will be displayed in Steam. Defaults to"
@echo " current proton.git branch name if available. A new build dir"
@echo " will be created for each build_name, so if you override this,"
@echo " remember to always set it!"
@echo " Current build name: $(build_name)"
@echo ""
@echo "Development targets:"
@echo " vagrant - Start Vagrant VM"
@echo " configure - Configure Proton build directory"
@echo " proton - Build Proton"
@echo " module - Build a single Wine module and copy into the shared directory."
@echo " Note: This is a development loop target. Use it only after building"
@echo " all of wine with one of the other targets."
@echo " Specify module variable: make module=kernel32 module"
@echo ""
@echo "Examples:"
@echo " "make install" - Build Proton and install into this user's Steam installation,"
@echo " with the current Proton branch name as the tool's name."
@echo ""
@echo " "make deploy" - Build a Proton deployment package in a tagged directory"
@echo " in vagrant_share/."
@echo ""
@echo " "make build_name=mytest install" - Build Proton with the tool name \"mytest\" and"
@echo " install into this user's Steam installation."
@echo ""
@echo " "make build_name=mytest module=dsound module" - Build only the dsound module"
@echo " in the \"mytest\" build directory and place it into vagrant_share/dsound/."
vagrant:
vagrant up
vagrant rsync
clean: vagrant
vagrant ssh -c "rm -rf build/"
vagrant ssh -c 'rm -rf $(BUILD_DIR)/'
configure: vagrant
vagrant ssh -c 'if [ ! -e build ]; then mkdir build; (cd build && $(CONFIGURE_CMD)); fi'
vagrant ssh -c 'if [ ! -e $(BUILD_DIR)/Makefile ]; then mkdir $(BUILD_DIR); (cd $(BUILD_DIR) && $(CONFIGURE_CMD)); fi'
proton: configure
vagrant ssh -c "make -C build/ dist"
vagrant ssh -c 'make -C $(BUILD_DIR)/ dist'
echo "Proton built in VM. Use 'install' or 'deploy' targets to retrieve the build."
install: configure
vagrant ssh -c "make -C build/ STEAM_DIR=/vagrant/ install"
vagrant ssh -c 'make -C $(BUILD_DIR)/ STEAM_DIR=/vagrant/ install'
cp -R vagrant_share/compatibilitytools.d/ $(STEAM_DIR)
echo "Proton installed to your local Steam installation"
deploy: configure
vagrant ssh -c "make -C build/ deploy"
vagrant ssh -c 'make -C $(BUILD_DIR)/ deploy'
mkdir -p vagrant_share/$(DEPLOY_DIR)
vagrant ssh -c "cp -a build/deploy/* /vagrant/$(DEPLOY_DIR)"
vagrant ssh -c 'cp -a $(BUILD_DIR)/deploy/* /vagrant/$(DEPLOY_DIR)'
echo "Proton deployed to vagrant_share/$(DEPLOY_DIR)"
module: configure
vagrant ssh -c "make -C build/ module=$(module) module"
vagrant ssh -c 'make -C $(BUILD_DIR)/ module=$(module) module'
mkdir -p vagrant_share/$(module)/lib{,64}/wine/
vagrant ssh -c "cp -a build/obj-wine32/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib/wine/"
vagrant ssh -c "cp -a build/obj-wine64/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib64/wine/"
vagrant ssh -c 'cp -a $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib/wine/'
vagrant ssh -c 'cp -a $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib64/wine/'

View File

@ -69,15 +69,19 @@ After checking out Proton and updating its submodules, you can use these
targets to build Proton:
`make install` - This will install Proton into your user's Steam directory.
You may need to restart the Steam client to see it. It will be called
`proton-localbuild`. Subsequent `make install` invocations will overwrite
this installation.
You may need to restart the Steam client to see it. The tool's name in the
Steam client will be based on the currently checked out branch of Proton. You
can override this name using the `build_name` variable.
`make deploy` - This will create a deployment tarball and set of files which
can be distributed as a Proton package. This is what we use to deploy Proton to
Steam users. The package will be dropped into a new directory in
`vagrant_share/`, named after the nearest Git tag (see `git describe`).
`make clean` - This will completely erase the build tree.
`make help` - View the Makefile documentation and examples.
We also provide targets useful for simple Wine development:
`make proton` - This will build Proton without copying its files out of the VM.