Skip to content

Instantly share code, notes, and snippets.

@cacharle
Created August 27, 2019 17:04
Show Gist options
  • Save cacharle/9cb62da4129518d8efc69b9c2821643f to your computer and use it in GitHub Desktop.
Save cacharle/9cb62da4129518d8efc69b9c2821643f to your computer and use it in GitHub Desktop.
NAME = name
CC = gcc
CCFLAGS = -Wall -Wextra
LDFLAGS =
HEADER = header.h
SRC = main.c
OBJ = $(SRC:.c=.o)
RM = rm -f
.PHONY: all
all: $(NAME)
$(NAME): $(OBJ) $(HEADER)
$(CC) $(LDFLAGS) $(CCFLAGS) -o $@ $(OBJ)
%.o: %.c
$(CC) $(LDFLAGS) $(CCFLAGS) -c -o $@ $<
.PHONY: clean
clean:
$(RM) $(OBJ)
.PHONY: fclean
fclean: clean
$(RM) $(NAME)
.PHONY: re
re: fclean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment