XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.72 2007/03/11 17:38:02 tsi Exp $
/*
 * Copyright (c) 1994-2004 by The XFree86 Project, Inc.
 * All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject
 * to the following conditions:
 *
 *   1.  Redistributions of source code must retain the above copyright
 *       notice, this list of conditions, and the following disclaimer.
 *
 *   2.  Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer
 *       in the documentation and/or other materials provided with the
 *       distribution, and in the same place and form as other copyright,
 *       license and disclaimer information.
 *
 *   3.  The end-user documentation included with the redistribution,
 *       if any, must include the following acknowledgment: "This product
 *       includes software developed by The XFree86 Project, Inc
 *       (http://www.xfree86.org/) and its contributors", in the same
 *       place and form as other third-party acknowledgments.  Alternately,
 *       this acknowledgment may appear in the software itself, in the
 *       same form and location as other such third-party acknowledgments.
 *
 *   4.  Except as contained in this notice, the name of The XFree86
 *       Project, Inc shall not be used in advertising or otherwise to
 *       promote the sale, use or other dealings in this Software without
 *       prior written authorization from The XFree86 Project, Inc.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE XFREE86 PROJECT, INC OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <Server.tmpl>

#if defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || defined(OpenBSDArchitecture)
#if BuildXInputExt
# if JoystickSupport
 JOYSTICK_SRC = bsd_jstk.c
# endif
# if DoLoadableServer
SHARED_CFLAGS = PositionIndependentCFlags
# else
#  if JoystickSupport
 JOYSTICK_OBJ = bsd_jstk.o
#  endif
# endif
#endif
#endif

#if defined(NetBSDArchitecture) \
    && ((OSMajorVersion == 1 && OSMinorVersion >= 1) || OSMajorVersion >= 2)
# if defined(AlphaArchitecture)
  IOPERMDEFINES = -DUSE_ALPHA_PIO
# elif defined(ArcArchitecture)
  IOPERMDEFINES = -DUSE_ARC_MMAP
# elif defined(Arm32Architecture)
  IOPERMDEFINES = -DUSE_ARM32_MMAP
# elif defined(PpcArchitecture) || \
	defined(Sparc64Architecture)
  IOPERM_SRC = ioperm_noop.c
  IOPERM_OBJ = ioperm_noop.o
# else
  IOPERMDEFINES = -DUSE_I386_IOPL
# endif
#elif defined(OpenBSDArchitecture) 
# if defined(i386Architecture) 
  IOPERMDEFINES = -DUSE_I386_IOPL
# elif defined(AMD64Architecture)
  IOPERMDEFINES = -DUSE_AMD64_IOPL
# else
  IOPERM_SRC = ioperm_noop.c
  IOPERM_OBJ = ioperm_noop.o
# endif
#elif defined(FreeBSDArchitecture)
# if defined(i386Architecture) || defined(AMD64Architecture)
  IOPERMDEFINES = -DUSE_DEV_IO
# elif defined(AlphaBsdArchitecture)
  IOPERMDEFINES = -DUSE_ALPHA_PORTS
# else
  IOPERM_SRC = ioperm_noop.c
  IOPERM_OBJ = ioperm_noop.o
# endif
#endif

MOUSESRC = bsd_mouse.c
MOUSEOBJ = bsd_mouse.o

KBDSRC = bsd_kbd.c bsd_KbdMap.c at_scancode.c
KBDOBJ = bsd_kbd.o bsd_KbdMap.o at_scancode.o

#if HasMTRRSupport
MTRRDEFINES = -DHAS_MTRR_SUPPORT
#endif

#if defined(NetBSDArchitecture) && defined(HasMTRRBuiltin)
MTRRDEFINES = -DHAS_MTRR_BUILTIN
#endif

#if UsbMouseSupport
USBMOUSEDEFINES1 = -DUSBMOUSE_SUPPORT
#if !HasLibUsb
LIBUSBINCLUDES = -Ilibusb
#define IHaveSubdirs
SUBDIRS = libusb
#else
#if HasLibUsbHid
USBMOUSEDEFINES2 = -DHAS_LIB_USB_HID
#endif
#endif
#endif
USBMOUSEDEFINES = $(USBMOUSEDEFINES1) $(USBMOUSEDEFINES2)

#if (defined(OpenBSDArchitecture) || defined(NetBSDArchitecture)) && defined(i386Architecture)
# if !defined(HasApmKqueue) || !HasApmKqueue
APMSRC = bsd_apm.c
APMOBJ = bsd_apm.o
# else
APMSRC = bsd_kqueue_apm.c
APMOBJ = bsd_kqueue_apm.o
# endif
#else
APMSRC = pm_noop.c
APMOBJ = pm_noop.o
#endif

#if defined(FreeBSDArchitecture) && (OSMajorVersion > 2)
KMODSRC = bsd_kmod.c
KMODOBJ = bsd_kmod.o
#else
KMODSRC = kmod_noop.c
KMODOBJ = kmod_noop.o
#endif

#if defined(i386Architecture) || \
    defined(ia64Architecture) || \
    defined(AMD64Architecture)
RES_SRC=stdResource.c
RES_OBJ=stdResource.o
#else
RES_SRC=bsdResource.c
RES_OBJ=bsdResource.o
#endif

#if defined(AlphaArchitecture)
AXP_SRC=bsd_ev56.c xf86Axp.c bsd_axp.c
AXP_OBJ=bsd_ev56.o xf86Axp.o bsd_axp.o
#endif

#if (defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || \
	defined(OpenBSDArchitecture)) && HasAgpGart
AGP_SRC=lnx_agp.c
AGP_OBJ=lnx_agp.o
#else
AGP_SRC=agp_noop.c
AGP_OBJ=agp_noop.o
#endif

#if defined(i386Architecture) || defined(AMD64Architecture)
VIDEO_SRC = i386_video.c
VIDEO_OBJ = i386_video.o
#elif defined(AlphaArchitecture)
VIDEO_SRC = alpha_video.c
VIDEO_OBJ = alpha_video.o
#elif defined(PpcArchitecture)
VIDEO_SRC = ppc_video.c
VIDEO_OBJ = ppc_video.o
#elif defined(Arm32Architecture)
VIDEO_SRC = arm_video.c
VIDEO_OBJ = arm_video.o
#elif defined(SparcArchitecture) || defined(Sparc64Architecture)
VIDEO_SRC = sparc64_video.c
VIDEO_OBJ = sparc64_video.o
#else
#error Unknown architecture !
#endif

/*
 * This is actually predicated on ARCH_PCI_INIT not being #define'd to
 * sparcPciInit in bus/Pci.h
 */
#if !defined(OpenBSDArchitecture) || !defined(SparcArchitecture)
PCI_SRC = stdPci.c
PCI_OBJ = stdPci.o
#endif

SRCS = bsd_init.c $(VIDEO_SRC) bsd_io.c bsd_VTsw.c \
       libc_wrapper.c $(IOPERM_SRC) std_kbdEv.c posix_tty.c $(MOUSESRC) \
       $(RES_SRC) $(PCI_SRC) vidmem.c $(JOYSTICK_SRC) sigio.c $(APMSRC) \
       $(AXP_SRC) $(KMODSRC) $(AGP_SRC) $(KBDSRC)

OBJS = bsd_init.o $(VIDEO_OBJ) bsd_io.o bsd_VTsw.o \
       libc_wrapper.o $(IOPERM_OBJ) std_kbdEv.o posix_tty.o $(MOUSEOBJ) \
       $(RES_OBJ) $(PCI_OBJ) vidmem.o $(JOYSTICK_OBJ) sigio.o $(APMOBJ) \
       $(AXP_OBJ) $(KMODOBJ) $(AGP_OBJ) $(KBDOBJ)

INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/include \
	   -I$(SERVERSRC)/mi $(APINCLUDES) \
	   $(LIBUSBINCLUDES) -I$(XF86OSSRC)/shared -I$(DRMINCLUDESDIR)

CONSDEFINES = XFree86ConsoleDefines
RESDEFINES = -DUSESTDRES

#if defined(HasNetBSDApertureDriver) && HasNetBSDApertureDriver
APDEFINES = -DHAS_APERTURE_DRV
#endif

DEFINES = $(CONSDEFINES) $(APDEFINES) $(IOPERMDEFINES) $(RESDEFINES) \
	  $(MTRRDEFINES) $(USBMOUSEDEFINES)

#if defined(AlphaArchitecture)
SpecialObjectRule(bsd_ev56.o, bsd_ev56.c, -mcpu=ev56)
#endif

SubdirLibraryRule($(OBJS))
NormalLibraryObjectRule()

#if BuildXF86DRI
#define IHaveSubdirs
SUBDIRS = drm

MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
#endif

#if BuildXInputExt
# if DoLoadableServer
#  if JoystickSupport
AllTarget(bsd_jstk.o)
#if 0
InstallDynamicModule(bsd_jstk.o,$(MODULEDIR),input)
#endif
#  endif
# endif
#endif

#if !defined(NetBSDArchitecture) && !defined(OpenBSDArchitecture) || \
	!defined(i386Architecture)
LinkSourceFile(pm_noop.c,../shared)
#endif
LinkSourceFile(ioperm_noop.c,../shared)
LinkSourceFile(std_kbdEv.c,../shared)
LinkSourceFile(at_scancode.c,../shared)
LinkSourceFile(posix_tty.c,../shared)
LinkSourceFile(libc_wrapper.c,../shared)
LinkSourceFile(stdResource.c,../shared)
#if !defined(OpenBSDArchitecture) || !defined(SparcArchitecture)
LinkSourceFile(stdPci.c,../shared)
#endif
LinkSourceFile(vidmem.c,../shared)
LinkSourceFile(sigio.c,../shared)
LinkSourceFile(kmod_noop.c,../shared)
#if (defined(FreeBSDArchitecture) || defined(NetBSDArchitecture) || \
	defined(OpenBSDArchitecture)) && HasAgpGart
LinkSourceFile(lnx_agp.c,../linux)
#else
LinkSourceFile(agp_noop.c,../shared)
#endif
#if defined(AlphaArchitecture)
LinkSourceFile(xf86Axp.c,../shared)
#endif

DependTarget()

#if UsbMouseSupport && !HasLibUsb
MakeSubdirs($(SUBDIRS))

DependSubdirs($(SUBDIRS))
#endif

#if 0
InstallDriverSDKDynamicModule(bsd_jstk.o,$(DRIVERSDKMODULEDIR))
#endif
