1 #------------------------------------------------------------------------------
2 # Make rules for building and installing a 3rdparty package.
4 # This file is intended for use in Makefile via the include directive, e.g.
6 # include $(BUILD_DIR)/package_rules.mk
8 # It is assumed that the environment has been set by sourcing the build
9 # resource file (buildrc).
11 # This file defines the following rules for library modules:
15 # Copyright (C) 2001, WSI Corporation
16 #------------------------------------------------------------------------------
18 # For portability, use the Bourne shell within Makefiles.
19 # There have been problems using the C-shell under Linux.
24 # RULE for building a package.
26 # make all will decompress the package from a compressed tar file.
27 # If decompression is successful, the tar file will be removed.
29 # It will then configure, make, check, and install the package using the
30 # standard GNU mechanisms. It uses make -i to ignore errors.
32 # After the standard GNU make is complete, an executable called custom_build
33 # will be executed, if such a script is found in the same directory as the
34 # Makefile that includes these rules. The custom_build executable should
35 # accept the PACKAGE and INSTALLDIR as arguments.
37 # This relies on settings for the variables:
38 # BASEDIR - absolute path where Makefile resides.
39 # PACKAGE - directory relative to BASEDIR containing package to build.
40 # INSTALLDIR - directory relative to BASEDIR into which to install package.
43 @if
[ ! -d
$(PACKAGE
) ]; then \
44 if
[ -e
$(PACKAGE
).
tar.gz
]; then \
45 gunzip
$(PACKAGE
).
tar.gz
; \
46 tar -xf
$(PACKAGE
).
tar ; \
47 rm -f
$(PACKAGE
).
tar ; \
50 if
[ ! -d
$(PACKAGE
) ]; then \
51 echo
"Could not find or successfully decompress package " $(PACKAGE
) ;\
54 if
[ ! -d
$(INSTALLDIR
) ]; then \
55 mkdir
$(INSTALLDIR
) ; \
56 if
[ ! -d
$(INSTALLDIR
) ]; then \
57 echo
"Cannot create installation directory " $(INSTALLDIR
) ;\
61 sh .
/configure
--prefix=$(BASEDIR
)/$(INSTALLDIR
) ;\
66 if
[ -x .
/custom_build
]; then \
67 .
/custom_build
$(PACKAGE
) $(INSTALLDIR
) ;\
71 # RULE for installing a package.
73 # This copies files from the packages install directory into the bin,
74 # lib, or src/3rdparty directories associated with a product source tree.
76 # Relies on proper setting of INSTALLDIR (explained above).
77 # Also relies on paths setup in buildrc.
83 echo
" Installing executables in $(BIN_DEST)" ;\
85 if
[ ! -d
$$f ]; then \
94 echo
" Installing libraries in $(LIB_DEST)" ;\
96 if
[ ! -d
$$f ]; then \
103 if
[ -d
include ]; then \
105 echo
" Installing header files in $(THIRDPARTY_DIR)" ;\
107 if
[ ! -d
$$f ]; then \
109 cp
$$f $(THIRDPARTY_DIR
) ;\
116 # RULE for cleaning up a package.
118 # make clean will do both the standard GNU make clean and make distclean rules.
119 # After that, it will tar and compress the package.
122 @if
[ -d
$(PACKAGE
) ]; then \
127 tar -cf
$(PACKAGE
).
tar $(PACKAGE
);\
129 gzip
$(PACKAGE
).
tar ; \