Hands-on task
Pattern rule and automatic variables
In /root/proj there are a.c and b.c. Write a Makefile that "builds" a same-named .o from each .c (in practice — copies the contents). Don't write two separate rules: use one pattern rule %.o: %.c with automatic variables ($< — the source, $@ — the target). Add a default target all: a.o b.o so that bare make builds both. The Makefile is handy to write in the Editor tab above the terminal: in a Makefile it puts a real TAB at the start of a recipe line.
- make
- pattern rules
- automatic variables
- default target