How to understand makefiles and python
I'm trying to understand how a makefile works for compiling some .ui files to .py (PyQt -> Python). This is the makefile that I am using that was autogenerated:
# Makefile for a PyQGIS plugin
UI_FILES = Ui_UrbanAnalysis.py
RESOURCE_FILES = resources.py
default: compile
compile: $(UI_FILES) $(RESOURCE_FILES开发者_如何转开发)
%.py : %.qrc
pyrcc4 -o $@ $<
%.py : %.ui
pyuic4 -o $@ $<
When I type:
$ make
I get the following message:
make: *** No rule to make target `compile', needed by `default'. Stop.
What am I doing incorrectly?
Thanks.
Not that I know the build steps you are trying to achieve, but both of these lines:
default: compile
compile: $(UI_FILES) $(RESOURCE_FILES)
look like target lines, so they should probably be:
default: compile
compile: $(UI_FILES) $(RESOURCE_FILES)
As it was make is probably trying to interpret the compile:...
line as an action which won't do anything and means that there is no compile
target.
One more thing, you might want to use
PHONY: default compile
to tell make that these are abstract targets and do not represent files. Just as a matter of good practice.
精彩评论