Reputation: 15752
I have a Makefile which should copy all dot files for me into the home directory. Unfortunately GNUMake
does not support wildcards as used in bash and the common wildcards $(wildcard *.c)
are limited to special file types.
My Makefile is:
SHELL := /bin/bash
profile:
@cp -r profile/ $(HOME)/
.PHONY: profile
Other variations I tried so far:
cp -r profile/* $(HOME)
=> cp: cannot stat profile/*: No such file or directory
cp -r profile/$(wildcard *) $(HOME)
=> tries to copies all files in the current directorycp -r $(wildcard profile/*) $(HOME)/
=> cp: missing destination file operand after /home/foobar
cp -r $(wildcard profile/*) $(HOME)/$(wildcard profile/*) =>
cp: missing destination file operand after /home/foobar`Upvotes: 2
Views: 2050
Reputation: 2426
Try The shell Function using direct shell commands in makefile
profile:
$shell(cp -r profile/* $(HOME)/)
.PHONY: profile
Otherwise set HOME variable at the beggining like this
SHELL := /bin/bash
HOME := $(shell echo $HOME)
profile:
@cp -r profile/* $(HOME)/
.PHONY: profile
Upvotes: 3