gcc - Cannot compile to a seperate directory using make -


i trying compile binaries directory... works if compile root directly. @ first, attempted let gcc handle passing bin/ under -o flag. make appears (infuriatingly) remove path target , compile root anyway...

then tried letting make handle it, fails find rule compile anything.

the other thing tried adding:

$(objects): 

to first rule, make calls gcc no arguments.

this version let make handle paths:

cc = gcc dir = bin targets = cloud controller objects = $(addprefix $(dir)/, $(targets))  all: $(objects)  $(dir)/%: $@.c         $(cc) $< -o $@  $(dir):         mkdir $(dir) 

this version let gcc handle paths:

cc = gcc dir = bin targets = cloud controller  all: $(targets)     mkdir $(dir) -p  %: $@.c         $(cc) $< -o $(dir)/$@ 

changed $@ %, per @etanreisner's comment.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -