aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-03-23 09:21:17 +0100
committertomsmeding <tom.smeding@gmail.com>2017-03-23 09:21:17 +0100
commitbcaed97d55d753be16f31e2fee676fbc603e8999 (patch)
tree3486b41154478fd4dcfc35d20ec0c901d56b509d
parent9970586deb17a5e8623619d79245fa4c7a5d9b55 (diff)
Makefile: Only link fltk on gui builds
-rw-r--r--Makefile10
1 files changed, 8 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index cd34801..23cc199 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,13 @@
CXX = g++
CXXFLAGS = -Wall -Wextra -std=gnu++11 -g -fwrapv -I$(FLTK)/include
-LDFLAGS = -L$(FLTK)/lib -lfltk
+LDFLAGS =
TARGETS = sim gui
FLTK = /usr/local/opt/fltk
+# Disable automatic rules
+.SUFFIXES:
+
.PHONY: all clean remake
all: $(TARGETS)
@@ -16,8 +19,11 @@ remake: clean
$(MAKE) all
-$(TARGETS): %: %.o $(filter-out $(addsuffix .o,$(TARGETS)),$(patsubst %.cpp,%.o,$(wildcard *.cpp)))
+sim: %: %.o $(filter-out $(addsuffix .o,$(TARGETS)),$(patsubst %.cpp,%.o,$(wildcard *.cpp)))
$(CXX) -o $@ $^ $(LDFLAGS)
+gui: %: %.o $(filter-out $(addsuffix .o,$(TARGETS)),$(patsubst %.cpp,%.o,$(wildcard *.cpp)))
+ $(CXX) -o $@ $^ $(LDFLAGS) -L$(FLTK)/lib -lfltk
+
%.o: %.cpp $(wildcard *.h)
$(CXX) $(CXXFLAGS) -c -o $@ $<