martin f. krafft | d4833b3 | 2013-06-23 13:35:46 +0200 | [diff] [blame^] | 1 | #!/usr/bin/make |
| 2 | # |
| 3 | # This file is part of reclass (http://github.com/madduck/reclass) |
| 4 | # |
| 5 | # Copyright © 2007–13 martin f. krafft <madduck@madduck.net> |
| 6 | # Released under the terms of the Artistic Licence 2.0 |
| 7 | # |
| 8 | |
| 9 | PYTHON_DEFAULT = /usr/bin/python |
| 10 | PYTHON := $(shell which python) |
| 11 | |
| 12 | IN_FILES = $(wildcard *.in adapters/*.in) |
| 13 | all: $(patsubst %.in,%,$(IN_FILES)) |
| 14 | .PHONY: all |
| 15 | |
| 16 | ifeq ($(PYTHON),$(PYTHON_DEFAULT)) |
| 17 | REPLACE_PYTHON_SHEBANG = cat |
| 18 | else |
| 19 | REPLACE_PYTHON_SHEBANG = sed -e 's,$(PYTHON_DEFAULT),$(PYTHON),g' |
| 20 | endif |
| 21 | |
| 22 | %: %.in ALWAYS_REDO |
| 23 | $(REPLACE_PYTHON_SHEBANG) $< > $@ |
| 24 | chmod +x $@ |
| 25 | |
| 26 | ALWAYS_REDO: |
| 27 | @: |