makefile - Generating bindings with automatic file list? -


i'm trying generate bindings using swig , automatic input file list. apparently not working (make says there's nothing target 'bindings'). manually calling make make whatever.i works intended.

i have following makefile.am now:

bin_programs = ptpcapture2 ptpcapture2_sources = *.scm bindsrcs = *.i bindscms = $(bindsrcs:.i=.scm)  .i.scm:     $(swig) -chicken -addextern $<  .scm.c: bindings     $(csc) -t -c $<  bindings: $(bindscms) 

what did miss or wrong?

if you're going use suffix rules, have add new suffixes list of known suffixes via .suffixes special target:

.suffixes: .i .scm 

it's simpler use pattern rules instead:

%.scm : %.i         $(swig) -chicken -addextern $<  %.c : %.scm bindings         $(csc) -t -c $< 

but real problem here have explicit wildcards, like:

ptpcapture2_sources := $(wildcard *.scm) bindsrcs := $(wildcard *.i) 

why this? because globbing not expanded when variable assigned, it's expanded when rule run. means line:

bindscms = $(bindsrcs:.i=.scm) 

sets bindscms string *.scm because bindsrcs not expanded, it's still literal string *.i.

why bad? because when make sees this:

bindings: *.scm 

it tries expand wildcard *.scm... none of files have been created yet , don't exist, , expands no files, , long target bindings exists there's nothing rebuild (it has no prerequisites).


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -