Merge branch 'master' of github.com:raboof/notion
[notion.git] / system-autodetect.mk
blobe8abc54cbb02a860cb4f4b9658dd893a28ae4219
1 ##
2 ## System settings
3 ##
5 # Some system may have custom pkg-config executable name
6 PKG_CONFIG ?= pkg-config
8 ##
9 ## Installation paths
12 # Installation path prefix. Unless you know what you're doing, the default
13 # of /usr/local is likely the correct choice.
14 #DIST: PREFIX=/usr/local
15 PREFIX ?= /usr/local
17 # Unless you are creating a package conforming to some OS's standards, you
18 # probably do not want to modify the following directories:
20 # Main binaries
21 BINDIR=$(PREFIX)/bin
22 # Some .lua files and ion-* shell scripts
23 SHAREDIR=$(PREFIX)/share/notion
24 # Manual pages
25 MANDIR=$(PREFIX)/share/man
26 # Some documents
27 DOCDIR=$(PREFIX)/share/doc/notion
28 # Nothing at the moment
29 LIBDIR=$(PREFIX)/lib
30 # Modules
31 MODULEDIR=$(LIBDIR)/notion/mod
32 # Compiled Lua source code
33 LCDIR=$(LIBDIR)/notion/lc
34 # ion-completefile (does not belong in SHAREDIR being a binary file)
35 EXTRABINDIR=$(LIBDIR)/notion/bin
36 # For notion-completeman system-wide cache
37 VARDIR=/var/cache/notion
38 # Message catalogs
39 LOCALEDIR=$(PREFIX)/share/locale
41 # Configuration .lua files. Overrideable, as config files are usually
42 # not placed under $(PREFIX).
43 ETCDIR ?= $(PREFIX)/etc/notion
45 # Force all include files to be installed to /usr even if the
46 # PREFIX is unset. No header files are installed at the moment
47 # though.
48 ifeq ($(PREFIX),)
49 INCDIR = $(PREFIX)/include/notion
50 else
51 INCDIR = /usr/include/notion
52 endif
54 # Executable suffix (for Cygwin).
55 #BIN_SUFFIX = .exe
59 ## Modules
62 # Set PRELOAD_MODULES=1 if your system does not support dynamically loaded
63 # modules through 'libdl' or has non-standard naming conventions.
64 # You will likely need this option on e.g. Cygwin and Mac OS X.
65 #PRELOAD_MODULES=1
67 # Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
68 # setting (for e.g. Lua, when not instructed by pkg-config).
69 DL_LIBS=-ldl
73 ## Lua
76 include $(TOPDIR)/build/lua-detect.mk
79 ## X libraries, includes and options
82 # Paths
83 X11_PREFIX ?= /usr/X11R6
84 # SunOS/Solaris
85 #X11_PREFIX ?= /usr/openwin
87 X11_LIBS=-L$(X11_PREFIX)/lib -lX11 -lXext
88 X11_INCLUDES=-I$(X11_PREFIX)/include
90 # XFree86 libraries up to 4.3.0 have a bug that can cause a segfault.
91 # The following setting should work around that situation.
92 DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
94 # Use the Xutf8 routines (XFree86 extension) instead of the Xmb routines
95 # in an UTF-8 locale. (No, you don't need this in UTF-8 locales, and
96 # most likely don't even want. It's only there because both Xmb and
97 # Xutf8 routines are broken, in different ways.)
98 #DEFINES += -DCF_DE_USE_XUTF8
100 # Remap F11 key to SunF36 and F12 to SunF37? You may want to set this
101 # on SunOS.
102 #DEFINES += -DCF_SUN_F1X_REMAP
106 ## Localisation
109 # If you're on an archaic system (such as relatively recent *BSD releases)
110 # without even dummy multibyte/widechar and localisation support, you may
111 # have to uncomment the following line:
112 #DEFINES += -DCF_NO_LOCALE -DCF_NO_GETTEXT
114 # On some other systems you may need to explicitly link against libintl.
115 #EXTRA_LIBS += -lintl
116 # You may also need to give the location of its headers. The following
117 # should work on Mac OS X (which needs the above option as well) with
118 # macports.
119 #EXTRA_INCLUDES += -I/opt/local/include
123 ## libc
126 # You may uncomment this if you know that your system C libary provides
127 # asprintf and vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
128 # defined, an implementation provided in libtu/sprintf_2.2/ is used.
129 HAS_SYSTEM_ASPRINTF ?= 1
131 # The following setting is needed with GNU libc for clock_gettime and the
132 # monotonic clock. Other systems may not need it, or may not provide a
133 # monotonic clock at all (which Ion can live with, and usually detect).
134 EXTRA_LIBS += -lrt
136 # Cygwin needs this. Also when you disable _BSD_SOURCE you may need it.
137 #DEFINES += -DCF_NO_GETLOADAVG
141 # If you're using/have gcc, it is unlikely that you need to modify
142 # any of the settings below this line.
144 #####################################################################
148 ## C compiler.
151 CC ?= gcc
153 WARN=-W -Wall -pedantic
155 CFLAGS += -Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) \
156 -DHAS_SYSTEM_ASPRINTF=$(HAS_SYSTEM_ASPRINTF)
158 LDFLAGS += -Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
159 EXPORT_DYNAMIC=-Xlinker --export-dynamic
161 # The following options are mainly for development use and can be used
162 # to check that the code seems to conform to some standards. Depending
163 # on the version and vendor of you libc, the options may or may not have
164 # expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
165 # may also have to define the other.
167 #C89_SOURCE=-ansi
169 POSIX_SOURCE?=-D_POSIX_C_SOURCE=200112L
170 BSD_SOURCE?=-D_BSD_SOURCE
172 # Most systems
173 XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
174 # SunOS, (Irix)
175 #XOPEN_SOURCE=-D__EXTENSIONS__
177 C99_SOURCE?=-std=c99 -DCF_HAS_VA_COPY
179 # The -DCF_HAS_VA_COPY option should allow for some optimisations, and
180 # in some cases simply defining
181 #C99_SOURCE=-DCF_HAS_VA_COPY
182 # might allow for those optimisations to be taken without any special
183 # libc or compiler options.
186 ## AR
189 AR ?= ar
190 ARFLAGS ?= cr
191 RANLIB ?= ranlib
195 ## Install & strip
198 INSTALL ?= sh $(TOPDIR)/install-sh -c
199 INSTALL_STRIP = -s
200 INSTALLDIR ?= mkdir -p
202 BIN_MODE ?= 755
203 DATA_MODE ?= 644
205 RM ?= rm
209 ## Debugging
212 INSTALL_STRIP =
213 CFLAGS += -g
215 ifeq ($(PRELOAD_MODULES),1)
216 X11_LIBS += -lXinerama -lXrandr
217 endif