Skip to content

Instantly share code, notes, and snippets.

@medicalwei

medicalwei/A

Created Sep 17, 2017
Embed
What would you like to do?
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