Skip to content

Instantly share code, notes, and snippets.

@marantz
Created December 26, 2020 02:41
Show Gist options
  • Save marantz/ee9c791ccef1f494244ea2a968ebc910 to your computer and use it in GitHub Desktop.
Save marantz/ee9c791ccef1f494244ea2a968ebc910 to your computer and use it in GitHub Desktop.
Makefile
appname := myapp
CXX := g++
CXXFLAGS := -Wall -g
srcfiles := $(shell find . -maxdepth 1 -name "*.cpp")
objects := $(patsubst %.cpp, %.o, $(srcfiles))
all: $(appname)
$(appname): $(objects)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(appname) $(objects) $(LDLIBS)
depend: .depend
.depend: $(srcfiles)
rm -f ./.depend
$(CXX) $(CXXFLAGS) -MM $^>>./.depend;
clean:
rm -f $(objects)
dist-clean: clean
rm -f *~ .depend
include .depend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment