Skip to content

Instantly share code, notes, and snippets.

@gyulkkajo
Created March 21, 2018 08:37
Show Gist options
  • Save gyulkkajo/b15dfb8894a7b73a3da0a059ee4c8d77 to your computer and use it in GitHub Desktop.
Save gyulkkajo/b15dfb8894a7b73a3da0a059ee4c8d77 to your computer and use it in GitHub Desktop.
Template of Makefile. It may be used for a simple c, c++ project.
.SUFFIXES : .c .o
CC = gcc
CFLAGS = -g $(INC)
INC = # -i -I
LIBS = # -l -L
DEPS = # *.h
OBJS = # *.o
TARGET =
all: $(TARGET)
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
$(TARGET): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -rf $(OBJS) $(TARGET) core
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment