Skip to content

Instantly share code, notes, and snippets.

@nightuser
Last active November 17, 2023 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nightuser/035b204186ae8a739691f99492edd184 to your computer and use it in GitHub Desktop.
Save nightuser/035b204186ae8a739691f99492edd184 to your computer and use it in GitHub Desktop.
Simple C++ Makefile
BIN := main
CXXFLAGS += -Wall -Wextra -std=c++20
CPPFLAGS += -MMD
SRCS := $(wildcard *.cc)
OBJS := $(SRCS:.cc=.o)
DEPS := $(SRCS:.cc=.d)
LINK.o = $(CXX) $(LDFLAGS) $(TARGET_ARCH)
all: $(BIN)
clean:
$(RM) $(BIN) *.o *.d
$(BIN): $(OBJS)
.PHONY: all clean
-include $(DEPS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment