GNU makes a double colon

I have a little problem understanding the following gmake syntax:

OBJ = foo.o bar.o $(OBJ): %.o: %.cpp $(CC) -c -MMD -MP $(INCLUDES) $(CFLAGS) $< -o $@ @sed (...create empty targets in file...) 

I'm not sure if $ (...):%. O:%. Cpp does !?

I think it can translate "% .o:%. Cpp" into the correct% .cpp dependencies - right? Google doesn't help much here - it only finds the regular double colon (target: :), something else!

Any tips? Thanks!

+4
source share
1 answer

This is a static pattern rule .

$(OBJ) is a list of goals. %.o : %.cpp means "for every target in the list that matches %.o , it depends on %.cpp " (where % is replaced accordingly).

+6
source

Source: https://habr.com/ru/post/1390202/


All Articles