/**/# Imakefile for xkeycaps;
/**/# Copyright (c) 1991, 1992, 1993, 1994 Jamie Zawinski.

/*
 *  To specify a different default keyboard (for when the vendor display
 *  string isn't recognised) do something like this:
 *
 *   KBD_DEFINES = -DDEFAULT_KBD_NAME="\"Sun3\""
 *
 *  to make there not be a default (meaning the keyboard must be specified
 *  if the vendor display string isn't recognised) you can do
 *
 *   KBD_DEFINES = -DDEFAULT_KBD_NAME=0
 *
 *  If you get a link error about _XInitKeysymDB being undefined, then add
 *  -DNO_XInitKeysymDB to DEFINES.  In this case, you might also want to
 *  add -DKEYSYMDB=\"/some/file/XKeysymDB\" to DEFINES, to tell XKeyCaps
 *  where the vendor-specific keysym database file resides.  Otherwise, you
 *  will have to set the $XKEYSYMDB environment variable before running this
 *  program, or else it won't let you select from the set of vendor keysyms.
 *
 *  Folks running R4 or older don't get to select from the set of vendor
 *  keysyms anyway.  If anyone comes up with a workaround to this, please
 *  let me know.  (The obvious workaround is to upgrade...)
 */

     XTRAP_SRCS = $(CURRENT_DIR)/xtrap.c
    SYSDEP_SRCS = $(CURRENT_DIR)/sunOS.c $(CURRENT_DIR)/hpux.c

#ifdef HAVE_XTRAP
  XTRAP_DEFINES = -DHAVE_XTRAP
 XTRAP_INCLUDES = 
     XTRAP_LIBS = -lXTrap
     XTRAP_OBJS = $(CURRENT_DIR)/xtrap.o
#endif

#ifdef SunArchitecture
    SYSDEP_OBJS = $(CURRENT_DIR)/sunOS.o
#endif

#ifdef HPArchitecture
 /* was defined(HPUX)||defined(hpux)||defined(__hpux)||defined(_HPUX_SOURCE) */
    SYSDEP_OBJS = $(CURRENT_DIR)/hpux.o

   /* This nonsense seems to be necessary to get the passwd struct on all HP
    * systems.  HP can't seem to make up their mind what preprocessor directive
    * they want to use to tell their header files that they are being compiled
    * on an HP.  Don't ask me to explain why these aren't the default...
    */
     HP_LOSSAGE = -D_HPUX_SOURCE -DHPUX -Dhpux -D__hpux -Aa -Dunix
#endif

          KBDIR = $(CURRENT_DIR)/kbds
       INCLUDES = -I$(KBDIR) $(XTRAP_INCLUDES)
        DEFINES = $(KBD_DEFINES) $(XTRAP_DEFINES) $(HP_LOSSAGE)
           SRCS = $(CURRENT_DIR)/xkeycaps.c $(CURRENT_DIR)/KbdWidget.c \
                  $(CURRENT_DIR)/KeyWidget.c $(CURRENT_DIR)/info.c \
                  $(CURRENT_DIR)/actions.c $(CURRENT_DIR)/commands.c \
                  $(CURRENT_DIR)/guess.c $(CURRENT_DIR)/all-kbds.c \
                  $(SYSDEP_SRCS) $(XTRAP_SRCS)
           OBJS = $(CURRENT_DIR)/xkeycaps.o $(CURRENT_DIR)/KbdWidget.o \
                  $(CURRENT_DIR)/KeyWidget.o $(CURRENT_DIR)/info.o \
                  $(CURRENT_DIR)/actions.o $(CURRENT_DIR)/commands.o \
                  $(CURRENT_DIR)/guess.o $(CURRENT_DIR)/all-kbds.o \
                  $(SYSDEP_OBJS) $(XTRAP_OBJS)
LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XTRAP_LIBS) $(XMULIB) $(XLIB)

     ALL_KBDS_1 = $(KBDIR)/NeXT-caps.h $(KBDIR)/NeXT-codes.h \
                  $(KBDIR)/NeXT-geom.h $(KBDIR)/NeXT-map.h \
                  $(KBDIR)/aviion300-codes.h $(KBDIR)/aviion300-map.h \
                  $(KBDIR)/dell-codes.h $(KBDIR)/dell-map.h \
                  $(KBDIR)/explorer-caps.h $(KBDIR)/explorer-codes.h \
                  $(KBDIR)/explorer-geom.h $(KBDIR)/explorer-map.h \
                  $(KBDIR)/ga5k-caps.h $(KBDIR)/ga5k-codes.h \
                  $(KBDIR)/ga5k-map.h $(KBDIR)/hclpc-caps.h \
                  $(KBDIR)/hclpc-codes.h $(KBDIR)/hclpc-geom.h \
                  $(KBDIR)/hclpc-map.h $(KBDIR)/hp700rx-codes.h \
                  $(KBDIR)/hp700rx-map.h $(KBDIR)/hpitf-caps.h \
                  $(KBDIR)/hpitf-codes.h $(KBDIR)/hpitf-geom.h \
                  $(KBDIR)/hpitf-map.h $(KBDIR)/hppc-codes.h \
                  $(KBDIR)/hppc-map.h $(KBDIR)/hppcde-codes.h \
                  $(KBDIR)/hppcde-map.h $(KBDIR)/labtam-caps.h \
                  $(KBDIR)/labtam-codes.h $(KBDIR)/labtam-map.h \
                  $(KBDIR)/linux101-2-codes.h $(KBDIR)/linux101-2-map.h \
                  $(KBDIR)/linux102-2-codes.h $(KBDIR)/linux102-2de-map.h \
                  $(KBDIR)/linux102-codes.h $(KBDIR)/linux102-map.h \
                  $(KBDIR)/linux102de-map.h $(KBDIR)/linux102fr-map.h
     ALL_KBDS_2 = $(KBDIR)/lk201-caps.h $(KBDIR)/lk201-codes.h \
                  $(KBDIR)/lk201-geom.h $(KBDIR)/lk201-map.h \
                  $(KBDIR)/lk401-caps.h $(KBDIR)/lk401-codes.h \
                  $(KBDIR)/lk401-map.h $(KBDIR)/lk421-caps.h \
                  $(KBDIR)/lk421-codes.h $(KBDIR)/lk421-geom.h \
                  $(KBDIR)/mac-caps.h $(KBDIR)/mac-codes.h \
                  $(KBDIR)/mac-geom.h $(KBDIR)/mac-map.h \
                  $(KBDIR)/mag3k-caps.h $(KBDIR)/mag3k-codes.h \
                  $(KBDIR)/mag3k-map.h $(KBDIR)/magat-caps.h \
                  $(KBDIR)/magat-codes.h $(KBDIR)/magat-geom.h \
                  $(KBDIR)/magat-map.h $(KBDIR)/ncd101-caps.h \
                  $(KBDIR)/ncd101-codes.h $(KBDIR)/ncd101-geom.h \
                  $(KBDIR)/ncd101-map.h $(KBDIR)/ncd102-caps.h \
                  $(KBDIR)/ncd102-codes.h $(KBDIR)/ncd102-map.h \
                  $(KBDIR)/ncd102f-caps.h $(KBDIR)/ncd102f-codes.h \
                  $(KBDIR)/ncd102f-map.h $(KBDIR)/ncd102n-caps.h \
                  $(KBDIR)/ncd102n-codes.h $(KBDIR)/ncd102n-map.h \
                  $(KBDIR)/ncd102sf-caps.h $(KBDIR)/ncd102sf-codes.h \
                  $(KBDIR)/ncd102sf-map.h $(KBDIR)/ncd108-caps.h \
                  $(KBDIR)/ncd108-codes.h $(KBDIR)/ncd108-geom.h
     ALL_KBDS_3 = $(KBDIR)/ncd108-map.h $(KBDIR)/ncd220-caps.h \
                  $(KBDIR)/ncd220-codes.h $(KBDIR)/ncd220-map.h \
                  $(KBDIR)/ncd97-caps.h $(KBDIR)/ncd97-codes.h \
                  $(KBDIR)/ncd97-geom.h $(KBDIR)/ncd97-map.h \
                  $(KBDIR)/ncdpc-caps.h $(KBDIR)/ncdpc-codes.h \
                  $(KBDIR)/ncdpc-map.h $(KBDIR)/nws1250-caps.h \
                  $(KBDIR)/nws1250-codes.h $(KBDIR)/nws1250-geom.h \
                  $(KBDIR)/nws1250-map.h $(KBDIR)/nws3410-caps.h \
                  $(KBDIR)/nws3410-codes.h $(KBDIR)/nws3410-geom.h \
                  $(KBDIR)/nws3410-map.h $(KBDIR)/pc101-2-caps.h \
                  $(KBDIR)/pc101-2-geom.h $(KBDIR)/pc101-caps.h \
                  $(KBDIR)/pc101-geom.h $(KBDIR)/pc102-2-geom.h \
                  $(KBDIR)/pc102-2de-caps.h $(KBDIR)/pc102-caps.h \
                  $(KBDIR)/pc102-geom.h $(KBDIR)/pc102de-caps.h \
                  $(KBDIR)/pc102fr-caps.h $(KBDIR)/rs2030-caps.h \
                  $(KBDIR)/rs2030-codes.h $(KBDIR)/rs2030-map.h \
                  $(KBDIR)/rs6k-aix-map.h $(KBDIR)/rs6k-caps.h \
                  $(KBDIR)/rs6k-codes.h $(KBDIR)/rs6k-xc-map.h \
                  $(KBDIR)/rs6kde-aix-map.h $(KBDIR)/rs6kde-caps.h \
                  $(KBDIR)/rs6kde-codes.h $(KBDIR)/rt-caps.h
     ALL_KBDS_4 = $(KBDIR)/rt-codes.h $(KBDIR)/rt-map.h \
                  $(KBDIR)/rtsw-caps.h $(KBDIR)/rtsw-codes.h \
                  $(KBDIR)/rtsw-map.h $(KBDIR)/rtsw8-map.h \
                  $(KBDIR)/sco110-codes.h $(KBDIR)/sco110-map.h \
                  $(KBDIR)/sgi-caps.h $(KBDIR)/sgi-codes.h \
                  $(KBDIR)/sgi-r4-map.h $(KBDIR)/sgi-r5-map.h \
                  $(KBDIR)/sun101a-codes.h $(KBDIR)/sun101a-xc-map.h \
                  $(KBDIR)/sun2-caps.h $(KBDIR)/sun2-codes.h \
                  $(KBDIR)/sun2-geom.h $(KBDIR)/sun2-xc-map.h \
                  $(KBDIR)/sun3-caps.h $(KBDIR)/sun3-codes.h \
                  $(KBDIR)/sun3-geom.h $(KBDIR)/sun3-xc-map.h \
                  $(KBDIR)/sun4-caps.h $(KBDIR)/sun4-codes.h \
                  $(KBDIR)/sun4-geom.h $(KBDIR)/sun4-ow-map.h \
                  $(KBDIR)/sun4-r6-map.h $(KBDIR)/sun4-xc-map.h \
                  $(KBDIR)/sun4sw-caps.h $(KBDIR)/sun4sw-codes.h \
                  $(KBDIR)/sun4sw-geom.h $(KBDIR)/sun4sw-map.h \
                  $(KBDIR)/sun5-caps.h $(KBDIR)/sun5-codes.h \
                  $(KBDIR)/sun5-geom.h $(KBDIR)/sun5-ow-map.h \
                  $(KBDIR)/sun5-r6-map.h $(KBDIR)/sun5-xc-map.h \
                  $(KBDIR)/sun5pc-caps.h $(KBDIR)/sun5pc-codes.h
     ALL_KBDS_5 = $(KBDIR)/sun5pc-ow-map.h $(KBDIR)/sun5pc-owde-map.h \
                  $(KBDIR)/sun5pc-xc-map.h $(KBDIR)/sun5pc-xc2-map.h \
                  $(KBDIR)/sun5sw-caps.h $(KBDIR)/sun5sw-codes.h \
                  $(KBDIR)/sun5sw-geom.h $(KBDIR)/sun5sw-ow-map.h \
                  $(KBDIR)/sun5sw-xc-map.h $(KBDIR)/sun5swfr-caps.h \
                  $(KBDIR)/sun5swfr-codes.h $(KBDIR)/sun5swfr-geom.h \
                  $(KBDIR)/sun5swfr-ow-map.h $(KBDIR)/tek101-4-map.h \
                  $(KBDIR)/tek101-caps.h $(KBDIR)/tek101-codes.h \
                  $(KBDIR)/tek101-geom.h $(KBDIR)/tek101-map.h \
                  $(KBDIR)/tek200-caps.h $(KBDIR)/tek200-codes.h \
                  $(KBDIR)/tek200-geom.h $(KBDIR)/tek200u-da-map.h \
                  $(KBDIR)/tek200u-de-map.h $(KBDIR)/tek200u-fi-map.h \
                  $(KBDIR)/tek200u-fr-map.h $(KBDIR)/tek200u-it-map.h \
                  $(KBDIR)/tek200u-ka-map.h $(KBDIR)/tek200u-no-map.h \
                  $(KBDIR)/tek200u-sp-map.h $(KBDIR)/tek200u-sw-map.h \
                  $(KBDIR)/tek200u-swde-map.h $(KBDIR)/tek200u-uk-map.h \
                  $(KBDIR)/tek200u-us-map.h $(KBDIR)/tek200v-us-map.h \
                  $(KBDIR)/tek200xesc-us-map.h $(KBDIR)/tek200xf11-us-map.h \
                  $(KBDIR)/tt-caps.h $(KBDIR)/tt-codes.h \
                  $(KBDIR)/tt-geom.h $(KBDIR)/tt-map.h
     ALL_KBDS_6 = $(KBDIR)/xmint-caps.h $(KBDIR)/xmint-codes.h \
                  $(KBDIR)/xmint-geom.h $(KBDIR)/xmint-map.h \
                  $(KBDIR)/xoft1-map.h $(KBDIR)/xoft2-codes.h \
                  $(KBDIR)/xoft2-map.h

       ALL_KBDS = $(ALL_KBDS_1) $(ALL_KBDS_2) $(ALL_KBDS_3) $(ALL_KBDS_4) \
                  $(ALL_KBDS_5) $(ALL_KBDS_6)
       ALL_HDRS = $(CURRENT_DIR)/version.h $(CURRENT_DIR)/xkeycaps.h \
                  $(CURRENT_DIR)/defaults.h $(CURRENT_DIR)/vroot.h \
                  $(CURRENT_DIR)/KeyWidget.h $(CURRENT_DIR)/KeyWidgetP.h \
                  $(CURRENT_DIR)/KbdWidget.h $(CURRENT_DIR)/KbdWidgetP.h \
                  $(CURRENT_DIR)/kbddef.h $(KBDIR)/all-kbds.h  $(ALL_KBDS)

       TARFILES = $(CURRENT_DIR)/README $(CURRENT_DIR)/xkeycaps.man \
                  $(CURRENT_DIR)/Imakefile $(SRCS) \
                  $(CURRENT_DIR)/build-map.sh \
                  $(CURRENT_DIR)/defining.txt $(CURRENT_DIR)/hierarchy.txt \
                  $(ALL_HDRS)
            TAR = gnutar
       COMPRESS = compress
   COMPRESS_EXT = Z
/**/#      COMPRESS = gzip --verbose --best
/**/#  COMPRESS_EXT = gz

ComplexProgramTarget(xkeycaps)

all-kbds.o:  kbddef.h $(KBDIR)/all-kbds.h $(ALL_KBDS)
KbdWidget.o: xkeycaps.h KeyWidget.h KeyWidgetP.h KbdWidget.h KbdWidgetP.h \
             kbddef.h
KeyWidget.o: xkeycaps.h KeyWidget.h KeyWidgetP.h KbdWidget.h KbdWidgetP.h
actions.o:   xkeycaps.h KeyWidget.h KeyWidgetP.h KbdWidget.h
commands.o:  xkeycaps.h KeyWidget.h KeyWidgetP.h KbdWidget.h KbdWidgetP.h \
             kbddef.h
info.o:      xkeycaps.h KeyWidget.h KeyWidgetP.h KbdWidgetP.h
xkeycaps.o:  xkeycaps.h KeyWidget.h KbdWidget.h  KbdWidgetP.h defaults.h \
             version.h
guess.o:     xkeycaps.h KeyWidget.h KbdWidget.h  KbdWidgetP.h kbddef.h

/* This really makes me sick... */
tar: Makefile $(TARFILES)
	@NAME=`sed -n							    \
  's/[^0-9]*\([0-9]\.[0-9][0-9]*\).*/xkeycaps-\1/p' version.h` ;	    \
  $(MAKE) $(MFLAGS) tar_hack NAME=$$NAME CURRENT_DIR=$$NAME

tar_hack::
	@rm -f $(NAME) ; ln -s . $(NAME) ;				    \
  echo creating tar file ${NAME}.tar.$(COMPRESS_EXT)... ;		    \
  $(TAR) -vchf - $(TARFILES)						    \
  | $(COMPRESS) > $(NAME).tar.$(COMPRESS_EXT) ;				    \
  rm $(NAME) ;								    \
  echo "" ; ls -lg $(NAME).tar.$(COMPRESS_EXT) ; echo ""
