Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Pattern Rules and Filter -- Errors and naive fix #60

Closed
a1exlism opened this issue Sep 26, 2022 · 1 comment
Closed

Static Pattern Rules and Filter -- Errors and naive fix #60

a1exlism opened this issue Sep 26, 2022 · 1 comment

Comments

@a1exlism
Copy link

a1exlism commented Sep 26, 2022

Issue: part Static Pattern Rules and Filter example not works well, refer to issue 40.

Refer issue 40 and the issue was fixed by commmit b7e9438.

However, the code was reversed after the new design commitment.
May the code change to this below due to 54?

obj_files = foo.result bar.o lose.o
src_files = foo.raw bar.c lose.c

all: $(obj_files)

$(filter %.o,$(obj_files)): %.o: %.c
	cc -c $< -o $@
	echo "target: $@ prereq: $<"
$(filter %.result,$(obj_files)): %.result: %.raw
	cc -c $< -o $@
	echo "target: $@ prereq: $<" 

$(src_files):
	touch $@

clean:
	rm -f $(src_files) $(obj_files)

But unfortunately, the implicit rule failed to work in this example, and no X.result file is generated.

@theicfire
Copy link
Owner

Thanks! Yeah it looks like I need the .PHONY: all in this example. Fixed here: e7a44a1

I don't need to explicitly run the cc commands like you've shown, because I don't even need output in this example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants