1.14. Makefile — With CFLAGS¶
1TARGETS=greeting_en greeting_fr greeting_es 2 3all: $(TARGETS) 4CFLAGS := -Wall 5 6$(TARGETS): 7 @gcc main.c $@.c $(CFLAGS) -o $@ 8 9clean: 10 -@rm $(TARGETS) 11 12run: 13 @$(foreach target,$(TARGETS), ./$(target);)
To compile that file with GCC, the command would be.
To execute the binary generated from the source file, the command would be as shown below.
If everything went fine, the output would be:
Hello World! Bonjour le monde! Hola Mundo!