Skip to content

Instantly share code, notes, and snippets.

@medicalwei
Created September 17, 2017 02:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medicalwei/1158e6ba0426ffe53267edda381d6108 to your computer and use it in GitHub Desktop.
Save medicalwei/1158e6ba0426ffe53267edda381d6108 to your computer and use it in GitHub Desktop.
Makefile dependency example
This is file A
INTERMEDIATES := B1 B2 B3
OBJS := B1Y1 B1Y2 B1Y3 B2Y1 B2Y2 B2Y3 B3Y1 B3Y2 B3Y3
.PHONY: all
all: $(OBJS)
clean:
rm -f $(INTERMEDIATES) $(OBJS)
B1: A
cp $< $@
echo "Through rule X1" >> $@
B2: A
cp $< $@
echo "Through rule X2" >> $@
B3: A
cp $< $@
echo "Through rule X3" >> $@
%Y1: %
cp $< $@
echo "Through rule Y1" >> $@
%Y2: %
cp $< $@
echo "Through rule Y2" >> $@
%Y3: %
cp $< $@
echo "Through rule Y3" >> $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment