Skip to content

Instantly share code, notes, and snippets.

@nongiach
Created December 24, 2016 11:14
Show Gist options
  • Save nongiach/71042fb2296d005e20305003d3737577 to your computer and use it in GitHub Desktop.
Save nongiach/71042fb2296d005e20305003d3737577 to your computer and use it in GitHub Desktop.
CC = gcc
CFLAGS += -W -Wall -Wextra
ifdef deb
CFLAGS += -g -Ddeb=
endif
LDFLAGS +=
NAME = a.out
SRC = main.c
OBJ = $(SRC:%.c=obj/%.o)
all: $(NAME)
obj/%.o : %.c
mkdir -p obj
$(CC) -c $(CFLAGS) $< -o $@ $(LDFLAGS)
$(NAME):$(OBJ)
$(CC) -o $(NAME) $(LDFLAGS) $(OBJ)
clean:
$(RM) $(OBJ)
$(RM) -r obj
fclean: clean
$(RM) $(NAME)
re: fclean all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment