GNU MAKE

make is a tool/build-system which configure, compile and build source files to generate binary/executable.

retain the temporary files

-save-temps flag tells the compiler to retain the temporary files it makes when we compile the program

target first dependency

genrate_app: %*.c
    gcc $< -o app

Explanation: %.c is the first dependency, so $< will be %.c

target nth dependency

genrate_app: %*.h %*.c
    gcc $(word 2,$^) -o app

Explanation: %.c is the second dependency, so $(word 2,$^) will be %.c


©2023-2024 rculock.com