Releasing version 3-2014010501
[notion/jeffpc.git] / system-autodetect.mk
blobd61c44726669e72e2cb0adc43b2a4ac7eb7abe4d
1 ##
2 ## System settings
3 ##
5 ##
6 ## Installation paths
7 ##
9 # Installation path prefix. Unless you know what you're doing, the default
10 # of /usr/local is likely the correct choice.
11 #DIST: PREFIX=/usr/local
12 PREFIX ?= /usr/local
14 # Unless you are creating a package conforming to some OS's standards, you
15 # probably do not want to modify the following directories:
17 # Main binaries
18 BINDIR=$(PREFIX)/bin
19 # Some .lua files and ion-* shell scripts
20 SHAREDIR=$(PREFIX)/share/notion
21 # Manual pages
22 MANDIR=$(PREFIX)/share/man
23 # Some documents
24 DOCDIR=$(PREFIX)/share/doc/notion
25 # Nothing at the moment
26 LIBDIR=$(PREFIX)/lib
27 # Modules
28 MODULEDIR=$(LIBDIR)/notion/mod
29 # Compiled Lua source code
30 LCDIR=$(LIBDIR)/notion/lc
31 # ion-completefile (does not belong in SHAREDIR being a binary file)
32 EXTRABINDIR=$(LIBDIR)/notion/bin
33 # For notion-completeman system-wide cache
34 VARDIR=/var/cache/notion
35 # Message catalogs
36 LOCALEDIR=$(PREFIX)/share/locale
38 # Configuration .lua files. Overrideable, as config files are usually
39 # not placed under $(PREFIX).
40 ETCDIR ?= $(PREFIX)/etc/notion
42 # Force all include files to be installed to /usr even if the
43 # PREFIX is unset. No header files are installed at the moment
44 # though.
45 ifeq ($(PREFIX),)
46 INCDIR = $(PREFIX)/include/notion
47 else
48 INCDIR = /usr/include/notion
49 endif
51 # Executable suffix (for Cygwin).
52 #BIN_SUFFIX = .exe
56 ## Modules
59 # Set PRELOAD_MODULES=1 if your system does not support dynamically loaded
60 # modules through 'libdl' or has non-standard naming conventions.
61 # You will likely need this option on e.g. Cygwin and Mac OS X.
62 #PRELOAD_MODULES=1
64 # Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
65 # setting (for e.g. Lua, when not instructed by pkg-config).
66 DL_LIBS=-ldl
70 ## Lua
73 include $(TOPDIR)/build/lua-detect.mk
76 ## X libraries, includes and options
79 # Paths
80 X11_PREFIX ?= /usr/X11R6
81 # SunOS/Solaris
82 #X11_PREFIX ?= /usr/openwin
84 X11_LIBS=-L$(X11_PREFIX)/lib -lX11 -lXext
85 X11_INCLUDES=-I$(X11_PREFIX)/include
87 # XFree86 libraries up to 4.3.0 have a bug that can cause a segfault.
88 # The following setting should work around that situation.
89 DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
91 # Use the Xutf8 routines (XFree86 extension) instead of the Xmb routines
92 # in an UTF-8 locale. (No, you don't need this in UTF-8 locales, and
93 # most likely don't even want. It's only there because both Xmb and
94 # Xutf8 routines are broken, in different ways.)
95 #DEFINES += -DCF_DE_USE_XUTF8
97 # Remap F11 key to SunF36 and F12 to SunF37? You may want to set this
98 # on SunOS.
99 #DEFINES += -DCF_SUN_F1X_REMAP
103 ## Localisation
106 # If you're on an archaic system (such as relatively recent *BSD releases)
107 # without even dummy multibyte/widechar and localisation support, you may
108 # have to uncomment the following line:
109 #DEFINES += -DCF_NO_LOCALE -DCF_NO_GETTEXT
111 # On some other systems you may need to explicitly link against libintl.
112 #EXTRA_LIBS += -lintl
113 # You may also need to give the location of its headers. The following
114 # should work on Mac OS X (which needs the above option as well) with
115 # macports.
116 #EXTRA_INCLUDES += -I/opt/local/include
120 ## libc
123 # You may uncomment this if you know that your system C libary provides
124 # asprintf and vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
125 # defined, an implementation provided in libtu/sprintf_2.2/ is used.
126 HAS_SYSTEM_ASPRINTF ?= 1
128 # The following setting is needed with GNU libc for clock_gettime and the
129 # monotonic clock. Other systems may not need it, or may not provide a
130 # monotonic clock at all (which Ion can live with, and usually detect).
131 EXTRA_LIBS += -lrt
133 # Cygwin needs this. Also when you disable _BSD_SOURCE you may need it.
134 #DEFINES += -DCF_NO_GETLOADAVG
138 # If you're using/have gcc, it is unlikely that you need to modify
139 # any of the settings below this line.
141 #####################################################################
145 ## C compiler.
148 CC ?= gcc
150 # Same as '-Wall -pedantic' without '-Wunused' as callbacks often
151 # have unused variables.
152 WARN= -W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
153 -Wtrigraphs -Wformat -Wchar-subscripts \
154 -Wparentheses -pedantic -Wuninitialized
156 CFLAGS += -Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) \
157 -DHAS_SYSTEM_ASPRINTF=$(HAS_SYSTEM_ASPRINTF)
159 LDFLAGS += -Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
160 EXPORT_DYNAMIC=-Xlinker --export-dynamic
162 # The following options are mainly for development use and can be used
163 # to check that the code seems to conform to some standards. Depending
164 # on the version and vendor of you libc, the options may or may not have
165 # expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
166 # may also have to define the other.
168 #C89_SOURCE=-ansi
170 POSIX_SOURCE?=-D_POSIX_C_SOURCE=200112L
171 BSD_SOURCE?=-D_BSD_SOURCE
173 # Most systems
174 XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
175 # SunOS, (Irix)
176 #XOPEN_SOURCE=-D__EXTENSIONS__
178 C99_SOURCE?=-std=c99 -DCF_HAS_VA_COPY
180 # The -DCF_HAS_VA_COPY option should allow for some optimisations, and
181 # in some cases simply defining
182 #C99_SOURCE=-DCF_HAS_VA_COPY
183 # might allow for those optimisations to be taken without any special
184 # libc or compiler options.
188 ## make depend
191 DEPEND_FILE=.depend
192 DO_MAKE_DEPEND=$(CC) -MM $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
193 MAKE_DEPEND=$(DO_MAKE_DEPEND) $(SOURCES) > $(DEPEND_FILE)
197 ## AR
200 AR ?= ar
201 ARFLAGS ?= cr
202 RANLIB ?= ranlib
206 ## Install & strip
209 INSTALL ?= sh $(TOPDIR)/install-sh -c
210 INSTALL_STRIP = -s
211 INSTALLDIR ?= mkdir -p
213 BIN_MODE ?= 755
214 DATA_MODE ?= 644
216 RM ?= rm
220 ## Debugging
223 INSTALL_STRIP =
224 CFLAGS += -g
226 ifeq ($(PRELOAD_MODULES),1)
227 X11_LIBS += -lXinerama -lXrandr
228 endif