From bcaed97d55d753be16f31e2fee676fbc603e8999 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Thu, 23 Mar 2017 09:21:17 +0100 Subject: Makefile: Only link fltk on gui builds --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Makefile') 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 $@ $< -- cgit v1.2.3-70-g09d2