-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakefile
103 lines (85 loc) · 3.48 KB
/
GNUmakefile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
ifeq ($(platform),windows)
ifeq ($(hiro),)
hiro := windows
endif
ifeq ($(hiro),windows)
hiro.flags = $(flags.cpp) -DHIRO_WINDOWS
hiro.options = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lole32 -lcomctl32 -lcomdlg32 -luxtheme -lmsimg32 -lshlwapi -ldwmapi
endif
ifeq ($(hiro),gtk2)
hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell pkg-config --cflags gtk+-2.0) -Wno-deprecated-declarations
hiro.options = $(shell pkg-config --libs gtk+-2.0)
endif
ifeq ($(hiro),gtk3)
hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell pkg-config --cflags gtk+-3.0) -Wno-deprecated-declarations
hiro.options = $(shell pkg-config --libs gtk+-3.0)
endif
endif
ifeq ($(platform),macos)
ifeq ($(hiro),)
hiro := cocoa
endif
ifeq ($(hiro),cocoa)
hiro.flags = $(flags.objcpp) -w -DHIRO_COCOA
hiro.options = -framework Cocoa -framework Carbon -framework IOKit -framework Security
endif
endif
ifneq ($(filter $(platform),linux bsd),)
ifeq ($(hiro),)
hiro := gtk2
endif
ifeq ($(hiro),gtk2)
hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell pkg-config --cflags gtk+-2.0) -Wno-deprecated-declarations
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs gtk+-2.0)
endif
ifeq ($(hiro),gtk2-se)
flags += -DHiro_SourceEdit
hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell pkg-config --cflags gtk+-2.0 gtksourceview-2.0) -Wno-deprecated-declarations
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs gtk+-2.0 gtksourceview-2.0)
endif
ifeq ($(hiro),gtk3)
hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell pkg-config --cflags gtk+-3.0) -Wno-deprecated-declarations
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs gtk+-3.0)
endif
ifeq ($(hiro),gtk3-se)
flags += -DHiro_SourceEdit
hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell pkg-config --cflags gtk+-3.0 gtksourceview-3.0) -Wno-deprecated-declarations
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs gtk+-3.0 gtksourceview-3.0)
endif
ifeq ($(hiro),qt4)
moc = /usr/local/lib/qt4/bin/moc
hiro.flags = $(flags.cpp) -DHIRO_QT=4 $(shell pkg-config --cflags QtCore QtGui)
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs QtCore QtGui)
endif
ifeq ($(hiro),qt5)
moc = $(shell pkg-config --variable=host_bins Qt5Core)/moc
hiro.flags = $(flags.cpp) -DHIRO_QT=5 -fPIC $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)
hiro.options = -L/usr/local/lib -lX11 $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Widgets)
endif
endif
ifeq ($(hiro.resource),)
hiro.resource := $(hiro.path)/windows/hiro.rc
endif
ifneq ($(findstring windres,$(windres)),)
# windres
hiro.resource.extension := .o
hiro.resource.command = $1 $2
else
# rc
hiro.resource.extension := .res
hiro.resource.command = /FO $2 $1
endif
hiro.objects := \
$(object.path)/hiro-$(hiro).o \
$(if $(filter windows,$(hiro)),$(object.path)/hiro-resource$(hiro.resource.extension))
$(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp
$(if $(filter qt%,$(hiro)),$(info Compiling $(hiro.path)/qt/qt.moc ...))
$(if $(filter qt%,$(hiro)),@$(moc) -i -o $(hiro.path)/qt/qt.moc $(hiro.path)/qt/qt.hpp)
$(info Compiling $(subst ../,,$<) ...)
@$(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@
$(object.path)/hiro-resource$(hiro.resource.extension): $(hiro.resource)
$(info Compiling $(subst ../,,$<) ...)
@$(windres) $(call hiro.resource.command,$<,$@)
hiro.verbose:
$(info hiro Target:)
$(info $([space]) $(hiro))