summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 8 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 8a2f666..15de4d0 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
bgstack15