aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 23cc19904f2144a5c0a16c1b088a94600bb99538 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
CXX = g++
CXXFLAGS = -Wall -Wextra -std=gnu++11 -g -fwrapv -I$(FLTK)/include
LDFLAGS =
TARGETS = sim gui

FLTK = /usr/local/opt/fltk

# Disable automatic rules
.SUFFIXES:

.PHONY: all clean remake

all: $(TARGETS)

clean:
	rm -f $(TARGETS) *.o

remake: clean
	$(MAKE) all


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 $@ $<