diff options
author | B Stack <bgstack15@gmail.com> | 2019-08-25 23:04:24 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-08-25 23:04:24 -0400 |
commit | da08171e0c65e278feeb8393b5a8f7e79ea491c9 (patch) | |
tree | 728fd5de284626349bc9e9f5f48f30a83e0efc10 /Makefile | |
parent | initial commit (diff) | |
download | cpp-master.tar.gz cpp-master.tar.bz2 cpp-master.zip |
Improved the makefile for multifile project, including header files.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,3 +1,5 @@ +# references: +# BUILD_DIR and per-.cpp file https://spin.atomicobject.com/2016/08/26/makefile-c-projects/ awkbin :=$(shell which awk) cpbin :=$(shell which cp) echobin :=$(shell which echo) @@ -20,13 +22,15 @@ LDFLAGS = -g src = $(wildcard *.cpp) obj = $(src:.cpp=.o) -OUTEXE = helloworld +BUILD_DIR ?= . + +OUTEXE = mine all: $(OUTEXE) -# compile -$(obj): $(src) - $(CXX) -c $(CXXFLAGS) $< +# compile, which is not actually used? +$(BUILD_DIR)%.o: %.cpp + $(CXX) -c $(CXXFLAGS) $+ # link $(OUTEXE): $(obj) |