forked from raboof/notion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystem-autodetect.mk
243 lines (181 loc) · 5.8 KB
/
system-autodetect.mk
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
##
## System settings
##
# Some system may have custom pkg-config executable name
PKG_CONFIG ?= pkg-config
##
## Installation paths
##
# Installation path prefix. Unless you know what you're doing, the default
# of /usr/local is likely the correct choice.
#DIST: PREFIX=/usr/local
PREFIX ?= /usr/local
# Unless you are creating a package conforming to some OS's standards, you
# probably do not want to modify the following directories:
# Main binaries
BINDIR=$(PREFIX)/bin
# Some .lua files and ion-* shell scripts
SHAREDIR=$(PREFIX)/share/notion
# Manual pages
MANDIR=$(PREFIX)/share/man
# Some documents
DOCDIR=$(PREFIX)/share/doc/notion
# Nothing at the moment
LIBDIR=$(PREFIX)/lib
# Modules
MODULEDIR=$(LIBDIR)/notion/mod
# Compiled Lua source code
LCDIR=$(LIBDIR)/notion/lc
# ion-completefile (does not belong in SHAREDIR being a binary file)
EXTRABINDIR=$(LIBDIR)/notion/bin
# For notion-completeman system-wide cache
VARDIR=/var/cache/notion
# Message catalogs
LOCALEDIR=$(PREFIX)/share/locale
# Configuration .lua files. Overrideable, as config files are usually
# not placed under $(PREFIX).
ETCDIR ?= $(PREFIX)/etc/notion
# Force all include files to be installed to /usr even if the
# PREFIX is unset. No header files are installed at the moment
# though.
ifeq ($(PREFIX),)
INCDIR = $(PREFIX)/include/notion
else
INCDIR = /usr/include/notion
endif
# Executable suffix (for Cygwin).
#BIN_SUFFIX = .exe
##
## Modules
##
# Set PRELOAD_MODULES=1 if your system does not support dynamically loaded
# modules through 'libdl' or has non-standard naming conventions.
# You will likely need this option on e.g. Cygwin and Mac OS X.
#PRELOAD_MODULES=1
# Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
# setting (for e.g. Lua, when not instructed by pkg-config).
DL_LIBS=-ldl
##
## Lua
##
include $(TOPDIR)/build/lua-detect.mk
##
## X libraries, includes and options
##
# Paths
X11_PREFIX ?= /usr/X11R6
# SunOS/Solaris
#X11_PREFIX ?= /usr/openwin
X11_LIBS=$(shell $(PKG_CONFIG) --libs x11 xext)
X11_INCLUDES=$(shell $(PKG_CONFIG) --cflags-only-I x11 xext)
# XFree86 libraries up to 4.3.0 have a bug that can cause a segfault.
# The following setting should work around that situation.
DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
# Use the Xutf8 routines (XFree86 extension) instead of the Xmb routines
# in an UTF-8 locale. (No, you don't need this in UTF-8 locales, and
# most likely don't even want. It's only there because both Xmb and
# Xutf8 routines are broken, in different ways.)
#DEFINES += -DCF_DE_USE_XUTF8
# Remap F11 key to SunF36 and F12 to SunF37? You may want to set this
# on SunOS.
#DEFINES += -DCF_SUN_F1X_REMAP
##
## Cairo
##
CAIRO_LIBS=$(shell $(PKG_CONFIG) --libs cairo)
CAIRO_INCLUDES=$(shell $(PKG_CONFIG) --cflags cairo)
# Be a bit lazy and include cairo all places x11 is used
X11_LIBS += $(CAIRO_LIBS)
X11_INCLUDES += $(CAIRO_INCLUDES)
## Xft support
##
USE_XFT?=$(shell (pkg-config --exists xft && echo 1))
ifeq ($(USE_XFT),1)
X11_INCLUDES += `pkg-config xft --cflags`
X11_LIBS += `pkg-config xft --libs`
DEFINES += -DHAVE_X11_XFT
DEFINES += -DHAVE_X11_BMF
else
DEFINES += -DHAVE_X11_BMF
endif
##
## Localisation
##
# If you're on an archaic system (such as relatively recent *BSD releases)
# without even dummy multibyte/widechar and localisation support, you may
# have to uncomment the following line:
#DEFINES += -DCF_NO_LOCALE -DCF_NO_GETTEXT
# On some other systems you may need to explicitly link against libintl.
#EXTRA_LIBS += -lintl
# You may also need to give the location of its headers. The following
# should work on Mac OS X (which needs the above option as well) with
# macports.
#EXTRA_INCLUDES += -I/opt/local/include
##
## libc
##
# You may uncomment this if you know that your system C libary provides
# asprintf and vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
# defined, an implementation provided in libtu/sprintf_2.2/ is used.
HAS_SYSTEM_ASPRINTF ?= 1
# The following setting is needed with GNU libc for clock_gettime and the
# monotonic clock. Other systems may not need it, or may not provide a
# monotonic clock at all (which Ion can live with, and usually detect).
EXTRA_LIBS += -lrt
# Cygwin needs this. Also when you disable _BSD_SOURCE you may need it.
#DEFINES += -DCF_NO_GETLOADAVG
#
# If you're using/have gcc, it is unlikely that you need to modify
# any of the settings below this line.
#
#####################################################################
##
## C compiler.
##
CC ?= gcc
WARN=-W -Wall -pedantic
CFLAGS += -Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) \
-DHAS_SYSTEM_ASPRINTF=$(HAS_SYSTEM_ASPRINTF)
LDFLAGS += -Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
EXPORT_DYNAMIC=-Xlinker --export-dynamic
# The following options are mainly for development use and can be used
# to check that the code seems to conform to some standards. Depending
# on the version and vendor of you libc, the options may or may not have
# expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
# may also have to define the other.
#C89_SOURCE=-ansi
POSIX_SOURCE?=-D_POSIX_C_SOURCE=200112L
BSD_SOURCE?=-D_BSD_SOURCE
# Most systems
XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
# SunOS, (Irix)
#XOPEN_SOURCE=-D__EXTENSIONS__
C99_SOURCE?=-std=c99 -DCF_HAS_VA_COPY
# The -DCF_HAS_VA_COPY option should allow for some optimisations, and
# in some cases simply defining
#C99_SOURCE=-DCF_HAS_VA_COPY
# might allow for those optimisations to be taken without any special
# libc or compiler options.
##
## AR
##
AR ?= ar
ARFLAGS ?= cr
RANLIB ?= ranlib
##
## Install & strip
##
INSTALL ?= sh $(TOPDIR)/install-sh -c
INSTALL_STRIP = -s
INSTALLDIR ?= mkdir -p
BIN_MODE ?= 755
DATA_MODE ?= 644
RM ?= rm
##
## Debugging
##
INSTALL_STRIP =
CFLAGS += -g
ifeq ($(PRELOAD_MODULES),1)
X11_LIBS += -lXinerama -lXrandr
endif