make - Why does my makefile not do what I want - clash between implicit and explicit rules? -



make - Why does my makefile not do what I want - clash between implicit and explicit rules? -

the website building sources consists of 2 groups of files. firstly, set of html files include php processing instructions process php at build time part of producing localized markup files. said way, html file source directory processed php pipes output html file in build directory same name.

the processing of said html files involves set of php files of own. these files carry actual localization texts substitute placeholders in source html files. these php files in turn generated corresponding xml files. because have chosen xml original carrier localization texts, project part of larger 1 rather heterogenous regards technology used, , went xml, aid ourselves in rapid translation.

secondly , lastly, have sec grouping of files can phone call "static" assets, need copied verbatim froms source build directory.

i struggling write concise makefile utilize gnu create expresses dependencies correctly. @ best accomplish half while make seems play tricks on me confuse me.

a brief legend makefile below, can prolly skip if pick things fast:

the process converts localization info xml format code php can include invoked xml_to_php_res. xml files in current (source) directory , match *.res.xml. invoking php include localization files , process html files abstracted in process_html script destdir create variable used indicate prefix of build directory. since it's prefix, ends /, when defined. obvious reasons, cannot match source directory. source directory assumed current directory the localization php files produced xml files match $(destdir)resources/*.php. don't discard them after utilize because 1) it's cache them , 2) can used @ runtime, if deemed required. guess these make calls "intermediate" prerequisites?

the makefile:

php_pp_def_files := $(patsubst ./%.res.xml,$(destdir)resources/%.php,$(shell find -name \*.res.xml)) $(destdir)resources/%.php: %.res.xml ./xml_to_php_res $< > $@ $(destdir)%.html: %.html $(php_pp_def_files) # each built html file depends on corresponding source html file , php localization definition files ./process_html $< > $@ $(destdir)%: % $(install_data) -d $< $@

the lastly rule appears interfere intentions. seems that's way make designed - if prerequisites sec rule don't exist, skips , considers 3rd rule instead. that's not need @ all.

i omitted all goal, because makefile doesn't work arbitrary individual files.

i think missing paramount knowledge how create searches , matches rules etc. have practically crisscrossed manual nth time now, it's quite cryptic , boo-eyed before manage grok :/

if understand correctly, lastly rule intended re-create static assets build directory. if so, first solution comes mind, turn static pattern rule. way, rule applies targets specify. you'll have build list of static assets this.

statics := $(addprefix $(destdir), ...) $(statics): $(destdir)%: % $(install_data) -d $< $@

edit in response comment: think next should build list of files need.

statics := $(addprefix $(destdir), $(filter-out %.php %.html, $(wildcard *)))

makefile make

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -