#  GNUmakefile for CPPFLAGS, LDFLAGS for interactivy, 
# ie interfaces and visualization.
#
#  Here we really set the CCPFLAGS, LDFLAGS for X11, Motif,...
# according various INC_xxx, LOAD_xxx flags setted in
# G4[UI, VIS]_[USE, BUILD].gmk. With this logic the 
# flags for one product (X11, Motif,...) will appear once 
# in the compilation/load command line.
#
#   Guy Barrand, 7th July 1998.

# Other libraries

########################### Inventor ############

# Should be before OpenGL.
ifdef INC_IV
  INC_GL    = 1
  CPPFLAGS += $(OIVFLAGS)
endif
ifdef LOAD_IV
  LOAD_GL  = 1
  INTYLIBS += $(OIVLIBS)
endif

########################### OPACS #######################
# OpenGL, X11 things must come after.

ifdef INC_OPACS
  CPPFLAGS += -I$(COROOT)/include -I$(XXROOT)/include -I$(WOROOT)/include
# Let Wo knows Xm (or Xaw) and Xo widget sets
  ifeq ($(G4_OPACS_WIDGET_SET),Xm)
    INC_XM    = 1
    CPPFLAGS += -DHAS_XM
  endif
  ifeq ($(G4_OPACS_WIDGET_SET),lesstif)
    INC_XM    = 1
    CPPFLAGS += -DHAS_XM
  endif
  ifeq ($(G4_OPACS_WIDGET_SET),Xaw)
    INC_XAW   = 1
    CPPFLAGS += -DHAS_XAW
  endif
  CPPFLAGS += -DHAS_XO  -DHAS_GO -I$(GOROOT)/include -I$(HOROOT)/include -I$(XOROOT)/include
endif

ifdef LOAD_OPACS
ifeq ($(G4_OPACS_WIDGET_SET),Xm)
  INC_XM   = 1
  LOAD_XM  = 1
  INTYLIBS += -L$(WOROOT)/$(OCONFIG) -lWoXm
endif
ifeq ($(G4_OPACS_WIDGET_SET),lesstif)
  INC_XM    = 1
  LOAD_XM   = 1
  INTYLIBS += -L$(WOROOT)/$(OCONFIG) -lWoXm
# lesstif is bugged on popup ; then OPACS/Xo uses Xaw for popup.
  LOAD_XAW  = 1
endif
ifeq ($(G4_OPACS_WIDGET_SET),Xaw)
  INC_XAW  = 1
  LOAD_XAW = 1
  INTYLIBS += -L$(WOROOT)/$(OCONFIG) -lWoXaw
endif
  INTYLIBS += -L$(WOROOT)/$(OCONFIG) -lWo 
  INTYLIBS += -L$(XOROOT)/$(OCONFIG) -lXo 
  INTYLIBS += -L$(GOROOT)/$(OCONFIG) -lGo 
  INTYLIBS += -L$(HOROOT)/$(OCONFIG) -lHo
  INTYLIBS += -L$(W3OROOT)/$(OCONFIG) -lW3o
  INTYLIBS += -L$(HTMLOROOT)/$(OCONFIG) -lHTMLo
ifndef LOAD_GL
  INTYLIBS += -L$(GLOROOT)/$(OCONFIG) -lGLXo -lGLUo -lGLo
endif
  INTYLIBS += -L$(XXROOT)/$(OCONFIG) -lXx
  INTYLIBS += -L$(COROOT)/$(OCONFIG) -lCo
endif


########################### OpenGL ###############################

ifdef INC_GL
  CPPFLAGS += $(OGLFLAGS)
endif
ifdef LOAD_GL
  INTYLIBS += $(OGLLIBS)
endif

########################### Motif, Athena, X11 ###################
# Motif raise X11 flags.

# Should be before X11.
ifdef INC_XM
  INC_X11   = 1
  CPPFLAGS += $(XMFLAGS)
endif
ifdef LOAD_XM
  LOAD_X11           = 1
  INTYLIBS += $(XMLIBS)
endif

# Should be before X11.
ifdef INC_XAW
  INC_X11   = 1
  CPPFLAGS += $(XAWFLAGS)
endif
ifdef LOAD_XAW
  LOAD_X11           = 1
  INTYLIBS += $(XAWLIBS)
endif

ifdef INC_X11
  CPPFLAGS += $(X11FLAGS)
endif
ifdef LOAD_X11
  INTYLIBS += $(X11LIBS)
endif

########################### and finally... #######################

ifdef G4INTY_BUILD_XT
  CPPFLAGS += -DG4INTY_BUILD_XT
endif

ifdef G4INTY_USE_XT
  CPPFLAGS += -DG4INTY_USE_XT
endif

ifdef G4INTY_BUILD_WIN32
  CPPFLAGS += -DG4INTY_BUILD_WIN32
endif

ifdef G4INTY_USE_WIN32
  CPPFLAGS += -DG4INTY_USE_WIN32
endif

