Skip to content

Instantly share code, notes, and snippets.

@simias
Created October 17, 2017 14:21
Show Gist options
  • Save simias/88ce34962779b5f057c962832cbcf7fe to your computer and use it in GitHub Desktop.
Save simias/88ce34962779b5f057c962832cbcf7fe to your computer and use it in GitHub Desktop.
NAME = mybin
CFLAGS = -Wall -O2 -MMD -MP
SRC = main.c
OBJ = $(SRC:%.c=%.o)
DEP = $(SRC:%.c=%.d)
$(NAME) : $(OBJ)
$(info LD $@)
$(CC) $(LDFLAGS) -o $@ $^
-include $(DEP)
%.o: %.c
$(info CC $@)
$(CC) -c $(CFLAGS) -o $@ $^
.PHONY : clean
clean:
$(info CLEAN $(NAME))
rm -f $(OBJ)
# Be verbose if V is set
$V.SILENT:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment