Use an explicit #define for MAXOF/MINOF
[notion.git] / system-autodetect.mk
blob3a9b371c784ca8333d7e12e8928536d1d1813f81
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 WARN=-W -Wall -pedantic
152 CFLAGS += -Os $(WARN) $(DEFINES) $(INCLUDES) $(EXTRA_INCLUDES) \
153 -DHAS_SYSTEM_ASPRINTF=$(HAS_SYSTEM_ASPRINTF)
155 LDFLAGS += -Wl,--as-needed $(LIBS) $(EXTRA_LIBS)
156 EXPORT_DYNAMIC=-Xlinker --export-dynamic
158 # The following options are mainly for development use and can be used
159 # to check that the code seems to conform to some standards. Depending
160 # on the version and vendor of you libc, the options may or may not have
161 # expected results. If you define one of C99_SOURCE or XOPEN_SOURCE, you
162 # may also have to define the other.
164 #C89_SOURCE=-ansi
166 POSIX_SOURCE?=-D_POSIX_C_SOURCE=200112L
167 BSD_SOURCE?=-D_BSD_SOURCE
169 # Most systems
170 XOPEN_SOURCE=-D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED
171 # SunOS, (Irix)
172 #XOPEN_SOURCE=-D__EXTENSIONS__
174 C99_SOURCE?=-std=c99 -DCF_HAS_VA_COPY
176 # The -DCF_HAS_VA_COPY option should allow for some optimisations, and
177 # in some cases simply defining
178 #C99_SOURCE=-DCF_HAS_VA_COPY
179 # might allow for those optimisations to be taken without any special
180 # libc or compiler options.
183 ## AR
186 AR ?= ar
187 ARFLAGS ?= cr
188 RANLIB ?= ranlib
192 ## Install & strip
195 INSTALL ?= sh $(TOPDIR)/install-sh -c
196 INSTALL_STRIP = -s
197 INSTALLDIR ?= mkdir -p
199 BIN_MODE ?= 755
200 DATA_MODE ?= 644
202 RM ?= rm
206 ## Debugging
209 INSTALL_STRIP =
210 CFLAGS += -g
212 ifeq ($(PRELOAD_MODULES),1)
213 X11_LIBS += -lXinerama -lXrandr
214 endif