Drop main() prototype. Syncs with NetBSD-8
[minix.git] / share / mk / bsd.x11.mk
blob92c5e2a8ae4383dfd7f2c554458484abfa8dd20b
1 # $NetBSD: bsd.x11.mk,v 1.117 2015/07/23 08:03:26 mrg Exp $
3 .include <bsd.init.mk>
5 BINDIR= ${X11BINDIR}
6 LIBDIR= ${X11USRLIBDIR}
7 MANDIR= ${X11MANDIR}
9 COPTS+= -fno-strict-aliasing
11 .include <bsd.sys.mk>
13 .if defined(USE_SSP) && (${USE_SSP} != "no")
14 CPPFLAGS+= -DNO_ALLOCA
15 .endif
17 X11FLAGS.VERSION= -DOSMAJORVERSION=5 -DOSMINORVERSION=99 # XXX
19 # THREADS_DEFINES
20 # LSC (MINIX): Not supported: -D_REENTRANT-DXTHREADS -DXUSE_MTSAFE_API
21 X11FLAGS.THREADS= -DXNO_MTSAFE_PWDAPI
23 # CONNECTION_FLAGS
24 # LSC (MINIX): Not supported: -DHAS_FCHOWN
25 X11FLAGS.CONNECTION= -DTCPCONN -DUNIXCONN -DHAS_STICKY_DIR_BIT \
28 .if (${USE_INET6} != "no")
29 X11FLAGS.CONNECTION+= -DIPv6
30 .endif
32 # EXT_DEFINES
33 X11FLAGS.BASE_EXTENSION= -DMITMISC -DXTEST -DXTRAP -DXSYNC -DXCMISC \
34 -DXRECORD -DMITSHM -DBIGREQS -DXF86VIDMODE \
35 -DXF86MISC -DDPMSExtension -DEVI \
36 -DSCREENSAVER -DXV -DXVMC -DGLXEXT \
37 -DRES
39 X11FLAGS.PERVASIVE_EXTENSION= -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP \
40 -DXCSECURITY -DTOGCUP -DXF86BIGFONT \
41 -DDPMSExtension -DPIXPRIV -DPANORAMIX \
42 -DRENDER -DRANDR -DXFIXES -DDAMAGE \
43 -DCOMPOSITE -DXEVIE
44 X11FLAGS.EXTENSION= ${X11FLAGS.BASE_EXTENSION} \
45 ${X11FLAGS.PERVASIVE_EXTENSION}
47 X11FLAGS.DIX= -DHAVE_DIX_CONFIG_H -D_BSD_SOURCE -DHAS_FCHOWN \
48 -DHAS_STICKY_DIR_BIT -D_POSIX_THREAD_SAFE_FUNCTIONS \
49 -DHAVE_XORG_CONFIG_H
50 X11INCS.DIX= -I${X11INCSDIR}/freetype2 \
51 -I${X11INCSDIR}/pixman-1 \
52 -I$(X11SRCDIR.xorg-server)/include \
53 -I$(X11SRCDIR.xorg-server)/Xext \
54 -I$(X11SRCDIR.xorg-server)/composite \
55 -I$(X11SRCDIR.xorg-server)/damageext \
56 -I$(X11SRCDIR.xorg-server)/xfixes \
57 -I$(X11SRCDIR.xorg-server)/Xi \
58 -I$(X11SRCDIR.xorg-server)/mi \
59 -I$(X11SRCDIR.xorg-server)/miext/shadow \
60 -I$(X11SRCDIR.xorg-server)/miext/damage \
61 -I$(X11SRCDIR.xorg-server)/render \
62 -I$(X11SRCDIR.xorg-server)/randr \
63 -I$(X11SRCDIR.xorg-server)/fb \
64 -I$(X11SRCDIR.xorg-server)/../include
66 X11FLAGS.DRI= -DGLXEXT -DXF86DRI -DGLX_DIRECT_RENDERING \
67 -DGLX_USE_DLOPEN -DGLX_USE_MESA
69 .if ${X11DRI} != "no"
70 X11FLAGS.EXTENSION+= ${X11FLAGS.DRI}
71 .endif
73 # ServerDefines
74 X11FLAGS.SERVER= -DSHAPE -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \
75 -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV \
76 -DPANORAMIX -DRENDER -DRANDR -DGCCUSESGAS \
77 -DAVOID_GLYPHBLT -DSINGLEDEPTH -DXvExtension \
78 -DXFree86Server -DXvMCExtension -DSMART_SCHEDULE \
79 -DBUILDDEBUG -DXResExtension -DNDEBUG
81 # OS_DEFINES
82 X11FLAGS.OS_DEFINES= -DDDXOSINIT -DSERVER_LOCK -DDDXOSFATALERROR \
83 -DDDXOSVERRORF -DDDXTIME -DUSB_HID
85 .if defined(__MINIX)
86 X11FLAGS.OS_DEFINES+= -DXOS_USE_NO_LOCKING
87 .endif # defined(__MINIX)
89 .if !(${MACHINE} == "acorn32" || \
90 ${MACHINE} == "amiga" || \
91 ${MACHINE} == "pmax" || \
92 ${MACHINE} == "sun3" || \
93 ${MACHINE} == "vax")
94 # EXT_DEFINES
95 X11FLAGS.EXTENSION+= -DXF86VIDMODE
97 # ServerDefines
98 X11FLAGS.SERVER+= -DXINPUT -DXFreeXDGA -DXF86VIDMODE
99 .endif
101 .if ${MACHINE_ARCH} == "alpha" || \
102 ${MACHINE_ARCH} == "sparc64" || \
103 ${MACHINE_ARCH} == "x86_64"
104 # ServerDefines
105 X11FLAGS.SERVER+= -D_XSERVER64
106 X11FLAGS.EXTENSION+= -D__GLX_ALIGN64
107 .endif
109 .if ${MACHINE} == "amd64" || \
110 ${MACHINE} == "cats" || \
111 ${MACHINE} == "i386" || \
112 ${MACHINE} == "macppc" || \
113 ${MACHINE} == "netwinder" || \
114 ${MACHINE} == "ofppc" || \
115 ${MACHINE} == "prep" || \
116 ${MACHINE} == "sgimips" || \
117 ${MACHINE} == "sparc64" || \
118 ${MACHINE} == "sparc" || \
119 ${MACHINE} == "shark" || \
120 ${MACHINE} == "zaurus"
121 # LOADABLE
122 X11FLAGS.LOADABLE= -DXFree86LOADER -DIN_MODULE -DXFree86Module \
123 ${${ACTIVE_CXX} == "gcc":? -fno-merge-constants :}
124 .endif
126 # XXX FIX ME
127 XVENDORNAMESHORT= '"X.Org"'
128 XVENDORNAME= '"The X.Org Foundation"'
129 XORG_RELEASE= '"Release 1.10.6"'
130 __XKBDEFRULES__= '"xorg"'
131 XLOCALE.DEFINES= -DXLOCALEDIR=\"${X11LIBDIR}/locale\" \
132 -DXLOCALELIBDIR=\"${X11LIBDIR}/locale\"
134 # XXX oh yeah, fix me later
135 XORG_VERSION_CURRENT="(((1) * 10000000) + ((10) * 100000) + ((6) * 1000) + 0)"
137 PRINT_PACKAGE_VERSION= awk '/^PACKAGE_VERSION=/ { \
138 match($$1, "([0-9]+\\.)+[0-9]+"); \
139 version = substr($$1, RSTART, RLENGTH); \
140 } END { print version }'
143 # Commandline to convert 'XCOMM' comments and 'XHASH' to '#', among other
144 # things. Transformed from the "CppSedMagic" macro from "Imake.rules".
146 X11TOOL_UNXCOMM= ${TOOL_SED} -e '/^\# *[0-9][0-9]* *.*$$/d' \
147 -e '/^\#line *[0-9][0-9]* *.*$$/d' \
148 -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
149 -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
150 -e '/^[ ]*XHASH/s/XHASH/\#/' \
151 -e '/\@\@$$/s/\@\@$$/\\/'
154 CPPFLAGS+= -DCSRG_BASED -DFUNCPROTO=15 -DNARROWPROTO
155 CPPFLAGS+= -I${DESTDIR}${X11INCDIR}
157 .if ${MACHINE_ARCH} == "x86_64"
158 CPPFLAGS+= -D__AMD64__
159 .endif
161 .if !defined(__MINIX)
162 LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR}
163 .else
164 LDFLAGS+= -Wl,-rpath,${X11USRLIBDIR} -L${DESTDIR}${X11USRLIBDIR}
165 .endif # !defined(__MINIX)
169 # .cpp -> "" handling
170 # CPPSCRIPTS list of files/scripts to run through cpp
171 # CPPSCRIPTFLAGS extra flags to ${CPP}
172 # CPPSCRIPTFLAGS_fn extra flags to ${CPP} for file `fn'
174 .if defined(CPPSCRIPTS) # {
175 .SUFFIXES: .cpp
177 .cpp:
178 ${_MKTARGET_CREATE}
179 rm -f ${.TARGET}
180 ${CC} -E -undef -traditional - \
181 ${CPPSCRIPTFLAGS_${.TARGET}:U${CPPSCRIPTFLAGS}} \
182 < ${.IMPSRC} | ${X11TOOL_UNXCOMM} > ${.TARGET}
184 realall: ${CPPSCRIPTS}
186 CLEANFILES+= ${CPPSCRIPTS}
187 .endif # }
190 # X.Org pkgconfig files handling
192 # PKGCONFIG is expected to contain a list of pkgconfig module names.
193 # They will produce the files <module1>.pc, <module2>.pc, etc, to be
194 # put in X11USRLIBDIR/pkgconfig.
196 # PKGDIST contains the name of a X11SRCDIR subscript where to find the
197 # source file for the pkgconfig files.
199 # If PKGDIST is not suitable, a consumer can set PKGDIST.<module> with
200 # the full path to the source file.
202 # Also, the consumer can use PKGDIST alone, and a PKGCONFIG will be
203 # derived from it. Many times, PKGDIST is capitalized and PKGCONFIG is
204 # the lower case version.
207 .if defined(PKGDIST) && !defined(PKGCONFIG)
208 PKGCONFIG= ${PKGDIST:tl}
209 .endif
210 .if defined(PKGCONFIG) && !defined(MLIBDIR)
212 .include <bsd.files.mk>
214 _PKGCONFIG_FILES= ${PKGCONFIG:C/$/.pc/}
216 .PHONY: pkgconfig-install
217 pkgconfig-install:
219 realall: ${_PKGCONFIG_FILES:O:u}
220 realinstall: pkgconfig-install
222 .for _pkg in ${PKGCONFIG:O:u} # {
224 PKGDIST.${_pkg}?= ${X11SRCDIR.${PKGDIST:U${_pkg}}}
225 _PKGDEST.${_pkg}= ${DESTDIR}${X11USRLIBDIR}/pkgconfig/${_pkg}.pc
227 .PATH: ${PKGDIST.${_pkg}}
229 FILESOWN_${_pkg}.pc= ${BINOWN}
230 FILESGRP_${_pkg}.pc= ${BINGRP}
231 FILESMODE_${_pkg}.pc= ${NONBINMODE}
233 ${_PKGDEST.${_pkg}}: ${_pkg}.pc __fileinstall
234 pkgconfig-install: ${_PKGDEST.${_pkg}}
236 # Add a dependancy on the configure file if it exists; this way we
237 # will rebuild the .pc file if the version in configure changes.
238 .if exists(${PKGDIST.${_pkg}}/configure)
239 ${_pkg}.pc: ${PKGDIST.${_pkg}}/configure Makefile
240 .endif
242 .endfor # }
244 # XXX
245 # The sed script is very, very ugly. What we actually need is a
246 # mknative-xorg script that will generate all the .pc files from
247 # running the autoconfigure script.
248 # And yes, it has to be split in multiple parts otherwise it's
249 # too long for sed to handle.
251 # hacky transforms:
252 # @XCBPROTO_VERSION@
254 .SUFFIXES: .pc.in .pc
255 .pc.in.pc:
256 ${_MKTARGET_CREATE}
257 rm -f ${.TARGET}
258 if [ -n '${PKGCONFIG_VERSION.${.PREFIX}}' ]; then \
259 _pkg_version='${PKGCONFIG_VERSION.${.PREFIX}}'; \
260 else \
261 _pkg_version=$$(${PRINT_PACKAGE_VERSION} \
262 ${PKGDIST.${.PREFIX}}/configure); \
263 fi; \
264 ${TOOL_SED} \
265 ${PKGCONFIG_SED_FLAGS} \
266 -e "s,@prefix@,${X11ROOTDIR},; \
267 s,@INSTALL_DIR@,${X11ROOTDIR},; \
268 s,@exec_prefix@,\\$$\{prefix\},; \
269 s,@libdir@,\\$$\{prefix\}/lib,; \
270 s,@includedir@,\\$$\{prefix\}/include,; \
271 s,@datarootdir@,\\$$\{prefix\}/share,; \
272 s,@datadir@,\\$$\{datarootdir\},; \
273 s,@appdefaultdir@,\\$$\{libdir}/X11/app-defaults,; \
274 s,@MAPDIR@,\\$$\{libdir\}/X11/fonts/util,; \
275 s,@ICONDIR@,\\$$\{datarootdir\}/icons,; \
276 s,@PACKAGE_VERSION@,$${_pkg_version},; \
277 s,@VERSION@,$${_pkg_version},; \
278 s,@COMPOSITEEXT_VERSION@,$${_pkg_version%.*},; \
279 s,@DAMAGEEXT_VERSION@,$${_pkg_version%.*},; \
280 s,@FIXESEXT_VERSION@,$${_pkg_version%.*},; \
281 s,@RANDR_VERSION@,$${_pkg_version%.*},; \
282 s,@RENDER_VERSION@,$${_pkg_version%.*}," \
283 -e "s,@LIBS@,,; \
284 s,@Z_LIBS@,-lz,; \
285 s,@LIBZ@,-lz,; \
286 s,@LIBBZ2@,-lbz2,; \
287 s,@xkb_base@,\\$$\{prefix\}/lib/X11/xkb,; \
288 s,@xcbincludedir@,\\$$\{prefix\}/share/xcb,; \
289 s,@fontrootdir@,\\$$\{libdir\}/X11/fonts,; \
290 s,@LIBXML2_LIBS@,,; \
291 s,@LIBXML2_CFLAGS@,,; \
292 s,@ICONV_CFLAGS@,,; \
293 s,@ICONV_LIBS@,,; \
294 s,@NEEDED@,,; \
295 s,@FT2_EXTRA_LIBS@,," \
296 -e "s,@moduledir@,\\$$\{libdir\}/modules,; \
297 s,@sdkdir@,\\$$\{includedir\}/xorg,; \
298 s,@PIXMAN_CFLAGS@,,; \
299 s,@LIB_DIR@,/lib,; \
300 s,@INSTALL_LIB_DIR@,\\$$\{prefix\}/lib,; \
301 s,@INSTALL_INC_DIR@,\\$$\{prefix\}/include,; \
302 s,@XKBPROTO_REQUIRES@,kbproto,; \
303 s,@XCBPROTO_VERSION@,1.7,; \
304 s,@FREETYPE_REQUIRES@,freetype2,; \
305 s,@EXPAT_LIBS@,-lexpat,; \
306 s,@FREETYPE_LIBS@,-lfreetype,; \
307 s,@DEP_CFLAGS@,,; \
308 s,@DEP_LIBS@,,; \
309 s,@X11_EXTRA_DEPS@,,; \
310 s,@XTHREAD_CFLAGS@,-D_REENTRANT,; \
311 s,@XTHREADLIB@,-lpthread,; \
312 s,@GL_LIB@,GL,; \
313 s,@GL_PC_REQ_PRIV@,x11 xext,; \
314 s,@GL_PC_LIB_PRIV@,-lm -lpthread,; \
315 s,@GL_PC_CFLAGS@,,; \
316 s,@GLX_TLS@,no," \
317 -e "s,@GLU_LIB@,GLU,; \
318 s,@GLU_PC_REQ@,gl,; \
319 s,@GLU_PC_REQ_PRIV@,,; \
320 s,@GLU_PC_LIB_PRIV@,-lGLU,; \
321 s,@GLU_PC_CFLAGS@,,; \
322 s,@GLUT_LIB@,glut,; \
323 s,@GLUT_PC_REQ_PRIV@,gl glu,; \
324 s,@GLUT_PC_LIB_PRIV@,-lglut,; \
325 s,@GLUT_PC_CFLAGS@,,; \
326 s,@GLW_PC_CFLAGS@,,; \
327 s,@GLW_PC_REQ_PRIV@,x11 xt,; \
328 s,@GLW_PC_LIB_PRIV@,,; \
329 s,@DRI_DRIVER_DIR@,\\$$\{libdir\}/modules/dri,; \
330 s,@DRI_PC_REQ_PRIV@,,; \
331 s,@GLW_LIB@,GLw,; \
332 s,@GBM_PC_REQ_PRIV@,,; \
333 s,@GBM_PC_LIB_PRIV@,,; \
334 s,@abi_ansic@,0.4,; \
335 s,@abi_videodrv@,5.0,; \
336 s,@abi_xinput@,4.0,; \
337 s,@abi_extension@,2.0,; \
338 s,@abi_font@,0.6,; \
339 s,@fchown_define@,-DHAS_FCHOWN,; \
340 s,@sticky_bit_define@,-DHAS_STICKY_DIR_BIT,;" \
341 -e "s,@PKG_CONFIG_LIBS@,${PKG_CONFIG_LIBS},; \
342 s,@PACKAGE@,${PKGDIST},; \
343 s,@PKGCONFIG_REQUIRES@,${PKGCONFIG_REQUIRES},; \
344 s,@PKGCONFIG_REQUIRES_PRIVATELY@,${PKGCONFIG_REQUIRES_PRIVATELY},; \
345 s,@ERRORDBDIR@,${X11LIBDIR},; \
346 s,@EXPAT_CFLAGS@,,; \
347 s,@FREETYPE_CFLAGS@,-I${X11ROOTDIR}/include/freetype2 -I${X11ROOTDIR}/include,;" \
348 -e '/^Libs:/ s%-L\([^ ]*\)%-Wl,-rpath,\1 &%g' \
349 < ${.IMPSRC} > ${.TARGET}.tmp && \
350 mv -f ${.TARGET}.tmp ${.TARGET}
352 CLEANFILES+= ${_PKGCONFIG_FILES} ${_PKGCONFIG_FILES:C/$/.tmp/}
353 .endif
356 # APPDEFS (app defaults) handling
358 .if defined(APPDEFS) # {
359 appdefsinstall:: .PHONY ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
360 .PRECIOUS: ${APPDEFS:@S@${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}@}
362 __appdefinstall: .USE
363 ${_MKTARGET_INSTALL}
364 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
365 ${.ALLSRC} ${.TARGET}
367 .for S in ${APPDEFS:O:u}
368 ${DESTDIR}${X11LIBDIR}/app-defaults/${S:T:R}: ${S} __appdefinstall
369 .endfor
371 realinstall: appdefsinstall
372 .endif # }
376 # .man page handling
378 .if (${MKMAN} != "no" && (${MAN:U} != "" || ${PROG:U} != "")) # {
379 CLEANDIRFILES+= ${MAN:U${PROG:D${PROG.1}}}
380 .endif # }
382 .SUFFIXES: .man .man.pre .1 .3 .4 .5 .7
384 _X11MANTRANSFORM= \
385 __adminmansuffix__ 8 \
386 __apploaddir__ ${X11ROOTDIR}/lib/X11/app-defaults \
387 __appmansuffix__ 1 \
388 __bindir__ ${X11BINDIR} \
389 __drivermansuffix__ 4 \
390 __filemansuffix__ 5 \
391 __LIB_MAN_SUFFIX__ 3 \
392 __libmansuffix__ 3 \
393 __logdir__ /var/log \
394 __mandir__ ${X11MANDIR} \
395 __miscmansuffix__ 7 \
396 __oslibmansuffix__ 3 \
397 __projectroot__ ${X11ROOTDIR} \
398 ${X11EXTRAMANTRANSFORMS}
400 # Note the escaping trick for _X11MANTRANSFORM using % to replace spaces
401 XORGVERSION= '"X Version 11"'
402 X11MANCPP?= no
403 _X11MANTRANSFORM+= \
404 __vendorversion__ ${XORGVERSION:C/ /%/gW} \
405 __XCONFIGFILE__ xorg.conf \
406 __xconfigfile__ xorg.conf \
407 __XCONFIGFILEMAN__ '__XCONFIGFILE__%(__filemansuffix__)' \
408 __xorgversion__ ${XORGVERSION:C/ /%/gW} \
409 __XSERVERNAME__ Xorg \
410 __xservername__ Xorg
412 _X11MANTRANSFORMCMD= ${TOOL_SED} -e 's/\\$$/\\ /' ${.IMPSRC}
414 .if ${X11MANCPP} != "no"
415 _X11MANTRANSFORMCMD+= | ${CC} -E -undef -traditional -
416 . for __def__ __value__ in ${_X11MANTRANSFORM}
417 _X11MANTRANSFORMCMD+= -D${__def__}=${__value__:C/%/ /gW}
418 . endfor
419 .else
420 _X11MANTRANSFORMCMD+= | ${TOOL_SED}
421 . for __def__ __value__ in ${_X11MANTRANSFORM}
422 _X11MANTRANSFORMCMD+= -e s,${__def__},${__value__:C/%/ /gW},g
423 . endfor
424 .endif
425 _X11MANTRANSFORMCMD+= ${X11EXTRAMANDEFS}
427 .man.1 .man.3 .man.4 .man.5 .man.7 .man.pre.1 .man.pre.4 .man.pre.5:
428 ${_MKTARGET_CREATE}
429 rm -f ${.TARGET}
430 ${_X11MANTRANSFORMCMD} | ${X11TOOL_UNXCOMM} > ${.TARGET}
432 ##### Pull in related .mk logic
433 .include <bsd.clean.mk>