# klasse Idee, das Target zu erraten: ifndef TARGET TARGET=$(basename $(shell egrep -l '"__main__"' *.py) ) target_guessed=true endif MAINTARGET:=$(TARGET).py PYTHON_CMD?=$(strip python $(PYTHON_FLAGS)) .PHONY: run all clean help all: $(MAINTARGET) # ifdef target_guessed @echo "No Target given in Makefile, guessing: $(TARGET)" endif run: all $(PYTHON_CMD) $(MAINTARGET) $(OPTIONS) clean: # das ifdef/endif darf nicht mit tab beginnen, da es sonst an # die Shell durchgereicht wird rm -rf *.pyc *~ help: @echo "Makefile for Python, customization via the following VARS:" @echo " TARGET : basename of main program-file" @echo " DEPENDS_ON : list of further dependencies" @echo " OPTIONS : list of options for the program" @echo " PYTHON_FLAGS : list of options for the python" $(MAINTARGET): $(DEPENDS_ON) %.py: ui/%.ui pyuic $< |grep -v "Extracting Python code from ".*".ui.h" > $@ ### Local Variables: *** ### mode:Makefile *** ### End: ***