Skip to content

Instantly share code, notes, and snippets.

@wooosh
Created November 17, 2020 00:00
Show Gist options
  • Save wooosh/a6db06fbe6d15fb972bf0d35c33ad940 to your computer and use it in GitHub Desktop.
Save wooosh/a6db06fbe6d15fb972bf0d35c33ad940 to your computer and use it in GitHub Desktop.
SRC=*.c
OBJ=$(SRC:.c=.o)
DEP=$(OBJ:.o=.d)
TARGET=myprogram
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJ)
$(LD) -o $(TARGET) $(OBJ)
-include $(DEP)
%.o: %.c
$(CC) $(CFLAGS) -MMD -MP -o $@ -c $<
clean:
$(RM) $(OBJ)
$(RM) $(TARGET)
$(RM) $(DEP)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment