Skip to content

Instantly share code, notes, and snippets.

@america
Last active March 22, 2017 04:13
Show Gist options
  • Select an option

  • Save america/8166926 to your computer and use it in GitHub Desktop.

Select an option

Save america/8166926 to your computer and use it in GitHub Desktop.
simple makefile for C
TARGET = test
CC = gcc
CFLAGS = -c -v
VPATH = src
SRC = test.c
OBJ = $(SRC:.c=.o)
all:$(TARGET)
$(TARGET):$(OBJ)
$(CC) -o $@ $(OBJ)
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) $<
clean:
rm -f $(TARGET) $(TARGET).exe
rm -f *.o *.obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment