pass on to the right sub-makefile target
[notion/jeffpc.git] / system.mk
bloba9047476685c85cb1bbd329975d7d9a23fd5e58c
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 # Configuration .lua files
20 ETCDIR=$(PREFIX)/etc/notion
21 # Some .lua files and ion-* shell scripts
22 SHAREDIR=$(PREFIX)/share/notion
23 # Manual pages
24 MANDIR=$(PREFIX)/share/man
25 # Some documents
26 DOCDIR=$(PREFIX)/share/doc/notion
27 # Nothing at the moment
28 INCDIR=$(PREFIX)/include/notion
29 # Nothing at the moment
30 LIBDIR=$(PREFIX)/lib
31 # Modules
32 MODULEDIR=$(LIBDIR)/notion/mod
33 # Compiled Lua source code
34 LCDIR=$(LIBDIR)/notion/lc
35 # ion-completefile (does not belong in SHAREDIR being a binary file)
36 EXTRABINDIR=$(LIBDIR)/notion/bin
37 # For notion-completeman system-wide cache
38 VARDIR=/var/cache/notion
39 # Message catalogs
40 LOCALEDIR=$(PREFIX)/share/locale
42 # Executable suffix (for Cygwin).
43 #BIN_SUFFIX = .exe
47 ## Modules
50 # Set PRELOAD_MODULES=1 if your system does not support dynamically loaded
51 # modules through 'libdl' or has non-standard naming conventions.
52 # You will likely need this option on e.g. Cygwin and Mac OS X.
53 #PRELOAD_MODULES=1
55 # Flags to link with libdl. Even if PRELOAD_MODULES=1, you may need this
56 # setting (for e.g. Lua, when not instructed by pkg-config).
57 DL_LIBS=-ldl
61 ## Lua
64 # To skip auto-detection of lua uncomment this and edit the variables below to
65 # suit your installation of lua.
66 #LUA_MANUAL=1
68 # Default to paths and names that should work for a build installed from the
69 # official Lua 5.1 source tarball.
70 LUA_DIR=/usr/local
71 LUA_LIBS=-L$(LUA_DIR)/lib -llua
72 LUA_INCLUDES = -I$(LUA_DIR)/include
73 LUA=$(LUA_DIR)/bin/lua
74 LUAC=$(LUA_DIR)/bin/luac
76 # Attempt to autodect lua using pkg-config.
78 ifndef LUA_MANUAL
80 # lua libraries and includes:
82 ifeq (5.2,$(findstring 5.2,$(shell pkg-config --exists lua5.2 && pkg-config --modversion lua5.2)))
83 ifneq ($(shell which lua5.2),)
84 HAS_LUA52=true
85 HAS_LUA=true
86 endif
87 endif
89 ifeq (5.1,$(findstring 5.1,$(shell pkg-config --exists lua5.1 && pkg-config --modversion lua5.1)))
90 ifneq ($(shell which lua5.1),)
91 HAS_LUA51=true
92 HAS_LUA=true
93 endif
94 endif
96 ifeq (5.1,$(findstring 5.1,$(shell pkg-config --exists lua && pkg-config --modversion lua)))
97 ifneq ($(shell which lua),)
98 HAS_LUA=true
99 endif
100 endif
102 ifdef HAS_LUA52
104 LUA_LIBS=`pkg-config --libs lua5.2`
105 LUA_INCLUDES=`pkg-config --cflags lua5.2`
106 LUA=`which lua5.2`
107 LUAC=`which luac5.2`
109 else ifdef HAS_LUA51
111 LUA_LIBS=`pkg-config --libs lua5.1`
112 LUA_INCLUDES=`pkg-config --cflags lua5.1`
113 LUA=`which lua5.1`
114 LUAC=`which luac5.1`
116 else ifdef HAS_LUA
118 LUA_LIBS=`pkg-config --libs lua`
119 LUA_INCLUDES=`pkg-config --cflags lua`
120 LUA=`which lua`
121 LUAC=`which luac`
123 endif # lua
125 endif # lua manual
128 ## X libraries, includes and options
131 # Paths
132 X11_PREFIX=/usr/X11R6
133 # SunOS/Solaris
134 #X11_PREFIX=/usr/openwin
136 X11_LIBS=-L$(X11_PREFIX)/lib -lX11 -lXext
137 X11_INCLUDES=-I$(X11_PREFIX)/include
139 # XFree86 libraries up to 4.3.0 have a bug that can cause a segfault.
140 # The following setting should work around that situation.
141 DEFINES += -DCF_XFREE86_TEXTPROP_BUG_WORKAROUND
143 # Use the Xutf8 routines (XFree86 extension) instead of the Xmb routines
144 # in an UTF-8 locale. (No, you don't need this in UTF-8 locales, and
145 # most likely don't even want. It's only there because both Xmb and
146 # Xutf8 routines are broken, in different ways.)
147 #DEFINES += -DCF_DE_USE_XUTF8
149 # Remap F11 key to SunF36 and F12 to SunF37? You may want to set this
150 # on SunOS.
151 #DEFINES += -DCF_SUN_F1X_REMAP
155 ## Localisation
158 # If you're on an archaic system (such as relatively recent *BSD releases)
159 # without even dummy multibyte/widechar and localisation support, you may
160 # have to uncomment the following line:
161 #DEFINES += -DCF_NO_LOCALE -DCF_NO_GETTEXT
163 # On some other systems you may need to explicitly link against libintl.
164 #EXTRA_LIBS += -lintl
165 # You may also need to give the location of its headers. The following
166 # should work on Mac OS X (which needs the above option as well) with
167 # macports.
168 #EXTRA_INCLUDES += -I/opt/local/include
172 ## libc
175 # You may uncomment this if you know that your system C libary provides
176 # asprintf and vasprintf. (GNU libc does.) If HAS_SYSTEM_ASPRINTF is not
177 # defined, an implementation provided in libtu/sprintf_2.2/ is used.
178 #HAS_SYSTEM_ASPRINTF=1
180 # The following setting is needed with GNU libc for clock_gettime and the
181 # monotonic clock. Other systems may not need it, or may not provide a
182 # monotonic clock at all (which Ion can live with, and usually detect).
183 EXTRA_LIBS += -lrt
185 # Cygwin needs this.
186 #DEFINES += -DCF_NO_GETLOADAVG
190 # If you're using/have gcc, it is unlikely that you need to modify
191 # any of the settings below this line.
193 #####################################################################
197 ## C compiler.
200 CC=gcc
202 # Same as '-Wall -pedantic' without '-Wunused' as callbacks often
203 # have unused variables.
204 WARN= -W -Wimplicit -Wreturn-type -Wswitch -Wcomment \
205 -Wtrigraphs -Wformat -Wchar-subscripts \
206 -Wparentheses -pedantic -Wuninitialized
208 CFLAGS=-Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
209 LDFLAGS=-Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
210 EXPORT_DYNAMIC=-Xlinker --export-dynamic
212 # The following options are mainly for development use and can be used
213 # to check that the code seems to conform to some standards. Depending
214 # on the version and vendor of you libc, the options may or may not have
215 # expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
216 # may also have to define the other.
218 #C89_SOURCE=-ansi
220 POSIX_SOURCE=-D_POSIX_C_SOURCE=200112L
222 # Most systems
223 #XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
224 # SunOS, (Irix)
225 #XOPEN_SOURCE=-D__EXTENSIONS__
227 #C99_SOURCE=-std=c99 -DCF_HAS_VA_COPY
229 # The -DCF_HAS_VA_COPY option should allow for some optimisations, and
230 # in some cases simply defining
231 #C99_SOURCE=-DCF_HAS_VA_COPY
232 # might allow for those optimisations to be taken without any special
233 # libc or compiler options.
237 ## make depend
240 DEPEND_FILE=.depend
241 DO_MAKE_DEPEND=$(CC) -MM $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES)
242 MAKE_DEPEND=$(DO_MAKE_DEPEND) $(SOURCES) > $(DEPEND_FILE)
246 ## AR
249 AR=ar
250 ARFLAGS=cr
251 RANLIB=ranlib
255 ## Install & strip
258 INSTALL=sh $(TOPDIR)/install-sh -c
259 INSTALL_STRIP=-s
260 INSTALLDIR=mkdir -p
262 BIN_MODE=755
263 DATA_MODE=644
265 RM=rm
269 ## Debugging
272 INSTALL_STRIP =
273 CFLAGS += -g
275 ifeq ($(PRELOAD_MODULES),1)
276 X11_LIBS += -lXinerama -lXrandr
277 endif