-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (48 loc) · 1.19 KB
/
Makefile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
prefix = .
OPT = -O3 -flto
includedir = $(prefix)/include
includedir_subdir = $(includedir)/simple-cairo-plot
libdir = $(prefix)/lib
target = $(libdir)/libsimple-cairo-plot.a
target_demo = plot_demo
# use gcc-ar for LTO support
AR = gcc-ar
ifeq '$(findstring sh,$(SHELL))' 'sh'
# UNIX, MSYS2 or Cygwin
MKDIR = mkdir -p
CP = cp
RM = rm -f
RMDIR = rm -f -r
run_demo = ./$(target_demo)
else
# Windows, neither MSYS2 nor Cygwin
MKDIR = mkdir
CP = copy
RM = del /Q
RMDIR = rmdir /S /Q
run_demo = $(target_demo)
endif
CXXFLAGS = -I$(includedir) `pkg-config gtkmm-3.0 --cflags --libs` $(OPT)
# for demo program
LDFLAGS = -L$(libdir) -lsimple-cairo-plot $(CXXFLAGS)
ifeq '$(OS)' 'Windows_NT'
LDFLAGS += -mwindows
endif
headers = $(foreach h, $(wildcard *.h), $(includedir_subdir)/$(h))
objects = circularbuffer.o plotarea.o recorder.o frontend.o
$(target): $(headers) $(objects) $(libdir)
$(AR) rcs $@ $(objects)
$(target_demo): demo.cpp $(target)
$(CXX) $< $(LDFLAGS) -o $@
$(libdir):
-$(MKDIR) $@
$(includedir_subdir):
-$(MKDIR) $@
$(includedir_subdir)/%.h: $(includedir_subdir) %.h
$(CP) $(@F) $<
demo: $(target_demo)
$(run_demo)
.PHONY: clean
clean:
-$(RMDIR) lib include
-$(RM) *.o $(target_demo)