Out-of-tree build makefile without automake? -


consider following dead-simple makefile:

foo: foo.c     $(cc) $(cflags) -o $@ $< 

and following directory structure ~/foo:

makefile foo.c 

how can adjust makefile such can like:

/tmp$ make -f ~/foo/makefile cc -o foo /home/me/foo/foo.c 

i have tried use $(srcdir), seems automake-specific. there other similar variable?

this it:

foo: /home/me/foo/foo.c     $(cc) $(cflags) -o $@ $< 

or this:

foo: foo.c     $(cc) $(cflags) -o $@ $<  vpath %.c /home/me/foo 

or, if don't want hard-code path makefile:

foo: foo.c     $(cc) $(cflags) -o $@ $<  vpath %.c $(dir $(lastword $(makefile_list))) 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -