Simplify the tests Makefil. Move all the defines and rules to a shared

makefile that can be included from different dirs.  Make creating tests in
subdirectories that depend on different libraries a lot easier and cleaner.
This commit is contained in:
ramiro 1998-05-03 11:48:15 +00:00
Родитель a3ac50b27f
Коммит 93928591c5
2 изменённых файлов: 260 добавлений и 129 удалений

Просмотреть файл

@ -24,20 +24,267 @@
# #
########################################################################## ##########################################################################
# Build demos ?
##
## Convert resource (.ad) files to source code
##
XFE_AD2C = $(DEPTH)/cmd/xfe/XfeWidgets/utils/ad2c
##
## Build demos ?
##
ifdef XFE_WIDGETS_BUILD_DEMO ifdef XFE_WIDGETS_BUILD_DEMO
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_DEMO XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_DEMO
endif endif
# Build unused ? ##
## Build ununsed ?
##
ifdef XFE_WIDGETS_BUILD_UNUSED ifdef XFE_WIDGETS_BUILD_UNUSED
XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED XFE_EXTRA_DEFINES += -DXFE_WIDGETS_BUILD_UNUSED
endif endif
ifeq ($(OS_ARCH),HP-UX) ##
SHARED_EXT = sl ## Xfe Widgets Library
else ##
SHARED_EXT = so XFE_STATIC_WIDGETS_LIB = $(DIST)/lib/libXfeWidgets.a
XFE_SHARED_WIDGETS_LIB = $(DIST)/bin/libXfeWidgets.$(DLL_SUFFIX)
XFE_WIDGETS_REQUIRES = XfeWidgets
##
## Xfe Widgets Test Library
##
XFE_STATIC_TEST_LIB = $(DIST)/lib/libXfeTest.a
XFE_SHARED_TEST_LIB = $(DIST)/bin/libXfeTest.$(DLL_SUFFIX)
XFE_TEST_REQUIRES = XfeTest
##
## Linux specific
##
ifeq ($(OS_ARCH),Linux)
-include $(DEPTH)/config/motif.mk
XFE_X_CC_FLAGS = -I/usr/X11R6/include
XFE_XM_CC_FLAGS =
XFE_X_LD_PATH = -L/usr/X11R6/lib
XFE_XM_LD_PATH =
XFE_XM_LIBS =\
$(MOZILLA_XM_2_1_BROKEN_LOCALE_FLAGS) \
-lXm \
$(MOZILLA_XM_2_1_PRINT_SHELL_FLAGS)
XFE_XT_LIBS = -lXt
XFE_X_LIBS = -lXmu -lXext -lX11 -lSM -lICE
XFE_USE_NATIVE_XPM = True
XFE_OS_LD_FLAGS =
endif endif
DEFINES += $(XFE_EXTRA_DEFINES) ##
## SunOS specific
##
ifeq ($(OS_ARCH),SunOS)
XFE_X_CC_FLAGS = -I/usr/openwin/include
XFE_XM_CC_FLAGS = -I/usr/dt/include
XFE_X_LD_PATH = -L/usr/openwin/lib
XFE_XM_LD_PATH = -L/usr/dt/lib
XFE_XM_LIBS = -lXm
XFE_XT_LIBS = -lXt
XFE_X_LIBS = -lX11
XFE_USE_NATIVE_XPM =
XFE_OS_LD_FLAGS =\
-lw \
-lintl \
-lsocket \
-lnsl \
-lgen \
-lm \
-ldl
endif
##
## IRIX specific
##
ifeq ($(OS_ARCH),IRIX)
XFE_X_CC_FLAGS =
XFE_XM_CC_FLAGS =
XFE_X_LD_PATH =
XFE_XM_LD_PATH =
XFE_XM_LIBS = -lXm
XFE_XT_LIBS = -lXt
XFE_X_LIBS = -lX11 -lSM -lICE
XFE_USE_NATIVE_XPM = True
XFE_OS_LD_FLAGS =
endif
##
## X Pixmap Library (Xpm)
##
ifeq ($(XFE_USE_NATIVE_XPM),True)
XFE_NATIVE_XPM_LIBS = -lXpm
else
XFE_STATIC_XPM_LIB = $(DIST)/lib/libXpm.a
XFE_SHARED_XPM_LIB = $(DIST)/bin/libXpm.$(DLL_SUFFIX)
XFE_XPM_REQUIRES = Xpm
endif
##
## Microline Widget Library (XmL)
##
ifeq ($(XFE_USE_NATIVE_XML),True)
XFE_NATIVE_XML_LIBS = -lXmL
else
XFE_STATIC_XML_LIB = $(DIST)/lib/libXmL.a
XFE_SHARED_XML_LIB = $(DIST)/bin/libXmL.$(DLL_SUFFIX)
XFE_XML_REQUIRES = Microline
endif
##
## Initialize the shared and static libs
##
XFE_SHARED_LIBS =
XFE_STATIC_LIBS =
##
## XfeTest required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_TEST_REQUIRES)),$(XFE_TEST_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_TEST_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_TEST_LIB)
endif
##
## XfeWidgets required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_WIDGETS_REQUIRES)),$(XFE_WIDGETS_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_WIDGETS_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_WIDGETS_LIB)
endif
##
## Microline required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_XML_REQUIRES)),$(XFE_XML_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_XML_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_XML_LIB)
endif
##
## Xpm required ?
##
ifeq ($(filter $(REQUIRES),$(XFE_XPM_REQUIRES)),$(XFE_XPM_REQUIRES))
XFE_SHARED_LIBS += $(XFE_SHARED_XPM_LIB)
XFE_STATIC_LIBS += $(XFE_STATIC_XPM_LIB)
endif
##
## GUI link path
##
XFE_GUI_LD_PATH =\
$(XFE_X_LD_PATH) \
$(XFE_XM_LD_PATH)
##
## GUI libs
##
XFE_GUI_LIBS =\
$(XFE_NATIVE_XML_LIBS) \
$(XFE_XM_LIBS) \
$(XFE_XT_LIBS) \
$(XFE_NATIVE_XPM_LIBS) \
$(XFE_X_LIBS)
##
## Shared link flags
##
XFE_SHARED_LD_FLAGS =\
$(XFE_GUI_LD_PATH) \
$(XFE_SHARED_LIBS) \
$(XFE_GUI_LIBS) \
$(XFE_OS_LD_FLAGS)
##
## Static link flags
##
XFE_STATIC_LD_FLAGS =\
$(XFE_GUI_LD_PATH) \
$(XFE_STATIC_LIBS) \
$(XFE_GUI_LIBS) \
$(XFE_OS_LD_FLAGS)
DEFINES += $(XFE_EXTRA_DEFINES)
##
## Resource source rule
##
$(OBJDIR)/%.ad.c:: %.ad $(XFE_AD2C)
@$(MAKE_OBJDIR)
@echo 'char * fallback_resources[] = {' > $@; \
$(XFE_AD2C) $< >> $@; \
echo '0};' >> $@
##
## Resource object rule
##
$(OBJDIR)/%.ad.o: $(OBJDIR)/%.ad.c
@$(MAKE_OBJDIR)
$(CC) -o $@ -c $<
##
## Static link rule
##
$(OBJDIR)/%.static: $(OBJDIR)/%.o $(OBJDIR)/%.ad.o $(XFE_STATIC_LIBS)
@$(MAKE_OBJDIR)
$(XFE_PURIFY) $(CC) -o $@ $< $(OBJDIR)/$*.ad.o $(XFE_STATIC_LD_FLAGS)
##
## Shared link rule
##
$(OBJDIR)/%.shared: $(OBJDIR)/%.o $(OBJDIR)/%.ad.o $(XFE_SHARED_LIBS)
@$(MAKE_OBJDIR)
$(XFE_PURIFY) $(CC) -o $@ $< $(OBJDIR)/$*.ad.o $(XFE_SHARED_LD_FLAGS)

Просмотреть файл

@ -15,9 +15,6 @@
# Copyright (C) 1998 Netscape Communications Corporation. All Rights # Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved. # Reserved.
#
DEPTH = ../../../.. DEPTH = ../../../..
ifdef XFE_WIDGETS_BUILD_UNUSED ifdef XFE_WIDGETS_BUILD_UNUSED
@ -56,127 +53,14 @@ REQUIRES = \
XfeTest \ XfeTest \
XfeWidgets XfeWidgets
PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.exe)) STATIC_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.static))
SHARED_PROGS = $(addprefix $(OBJDIR)/, $(CSRCS:.c=.shared))
include $(DEPTH)/config/rules.mk include $(DEPTH)/config/rules.mk
include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk include $(DEPTH)/cmd/xfe/XfeWidgets/XfeWidgets.mk
all:: $(PROGS) all:: $(STATIC_PROGS) $(SHARED_PROGS)
install:: $(PROGS) install:: $(STATIC_PROGS) $(SHARED_PROGS)
LDFLAGS = shared: $(SHARED_PROGS)
static: $(STATIC_PROGS)
SHARED_XFE_LIBS = \
$(DIST)/bin/libXfeTest.$(DLL_SUFFIX) \
$(DIST)/bin/libXfeWidgets.$(DLL_SUFFIX)
ifeq (,$(filter Linux IRIX ,$(OS_ARCH)))
SHARED_XFE_LIBS += $(DIST)/bin/libXpm.$(DLL_SUFFIX)
STATIC_XFE_LIBS += $(DIST)/lib/libXpm.a
else
XPM_LD_FLAGS = -lXpm
endif
STATIC_XFE_LIBS = \
$(DIST)/lib/libXfeTest.a \
$(DIST)/lib/libXfeWidgets.a
DIST_FLAGS = -L$(DIST)/bin
ifeq ($(OS_ARCH),AIX)
XFE_FLAGS = $(STATIC_XFE_LIBS)
else
XFE_FLAGS = $(SHARED_XFE_LIBS)
endif
ifeq ($(OS_ARCH),Linux)
-include $(DEPTH)/config/motif.mk
endif
XM_LD_FLAGS = -lXm $(NS_MOTIF2_XP_LD_FLAGS)
X_LD_FLAGS = $(XM_LD_FLAGS) -lXt -lXmu $(XPM_LD_FLAGS) -lXext -lX11
OS_BEFORE_FLAGS =
OS_AFTER_FLAGS =
ifeq ($(OS_ARCH),SunOS)
OS_BEFORE_LDFLAGS =\
-L/usr/dt/lib \
-L/usr/openwin/lib
OS_AFTER_LDFLAGS =\
-lw \
-lintl \
-lsocket \
-lnsl \
-lgen \
-lm \
-ldl
endif
ifeq ($(OS_ARCH),AIX)
OS_BEFORE_LDFLAGS =\
-L/usr/dt/lib
endif
ifeq ($(OS_ARCH),IRIX)
endif
ifeq ($(OS_ARCH),Linux)
OS_BEFORE_LDFLAGS = -L/usr/X11R6/lib
endif
ifeq ($(OS_ARCH),HP-UX)
OS_BEFORE_LDFLAGS = -L$(DIST)/bin
endif
LDFLAGS =\
$(OS_BEFORE_LDFLAGS) \
$(DIST_FLAGS) \
$(XFE_FLAGS) \
$(X_LD_FLAGS) \
$(OS_AFTER_LDFLAGS)
##
## Test dependancies
##
#OTHER_DEPS = Makefile $(XFE_FLAGS)
OTHER_DEPS = $(XFE_FLAGS)
##
## Resource source rule
##
$(OBJDIR)/%.ad.c:: %.ad # Makefile
@$(MAKE_OBJDIR)
@echo 'char * fallback_resources[] = {' > $@; \
./ad2c $< >> $@; \
echo '0};' >> $@
##
## Resource object rule
##
$(OBJDIR)/%.ad.o: $(OBJDIR)/%.ad.c
@$(MAKE_OBJDIR)
$(CC) -o $@ -c $<
##
## Binary link rule
##
$(OBJDIR)/%.exe: $(OBJDIR)/%.o $(OBJDIR)/%.ad.o $(OTHER_DEPS)
@$(MAKE_OBJDIR)
$(XFE_PURIFY) $(CC) -o $@ $< $(OBJDIR)/$*.ad.o $(LDFLAGS)