improve of cmpl.
[bush.git] / build / shlib / others.shlib
blob5a4e6bf04a4240b0b01b5a261fbd5d622c633718
3 ###################################################################
5 libdep_build ()
7         # $(LIBDEP): .build
10 LIBINTL_H ()
12         # ${LIBINTL_H}: ${INTL_DEP}
15 builtins_common_o ()
17         # ${DEFDIR}/common.o:   $(BUILTIN_SRCDIR)/common.c
18         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} common.o) || exit 1
22 builtins_bushgetopt_o ()
24         # ${DEFDIR}/bushgetopt.o:       $(BUILTIN_SRCDIR)/bushgetopt.c
25         @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} bushgetopt.o) || exit 1
28 ###################################################################
30 info_dvi_ps ()
32         # $1: info/dvi/ps
33         (cd ${DOCDIR} ; ${MAKE} ${MFLAGS} CFLAGS='${CCFLAGS}' $1 )
36 documentation ()
38         # 
39         (cd ${DOCDIR} ; ${MAKE} ${MFLAGS} )
42 ###################################################################
44 install ()
46         # installdirs:
47         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${bindir}
48         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${man1dir}
49         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${infodir}
50         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${docdir}
51         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} installdirs )
53         # install-strip:
54         ${MAKE} ${MFLAGS} INSTALL_PROGRAM='${INSTALL_PROGRAM} -s' \
55                 prefix=${prefix} exec_prefix=${exec_prefix} \
56                 DESTDIR=${DESTDIR} install
58         # install:      .made installdirs
59         ${INSTALL_PROGRAM} ${INSTALLMODE} ${Program} ${DESTDIR}${bindir}/${Program}
60         ${INSTALL_SCRIPT} ${INSTALLMODE2} bushbug ${DESTDIR}${bindir}/bushbug
61         ${INSTALL_DATA} ${OTHER_DOCS} ${DESTDIR}${docdir}
62         ( cd ${DOCDIR} ; ${MAKE} ${MFLAGS} \
63                 man1dir=${man1dir} man1ext=${man1ext} \
64                 man3dir=${man3dir} man3ext=${man3ext} \
65                 infodir=${infodir} htmldir=${htmldir} DESTDIR=${DESTDIR} install )
66         ( cd ${DEFDIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
67         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
68         ( cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} install )
71 uninstall ()
73         # uninstall:    .made
74         ${RM} ${DESTDIR}${bindir}/${Program} ${DESTDIR}${bindir}/bushbug
75         ( cd ${DESTDIR}${docdir} && ${RM} ${OTHER_INSTALLED_DOCS} )
76         ( cd ${DOCDIR} ; ${MAKE} ${MFLAGS} \
77                 man1dir=${man1dir} man1ext=${man1ext} \
78                 man3dir=${man3dir} man3ext=${man3ext} \
79                 infodir=${infodir} htmldir=${htmldir} DESTDIR=${DESTDIR} uninstall )
80         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
81         ( cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} uninstall )
84 install_hdrs ()
86         # install-headers-dirs:
87         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${headersdir}
88         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${headersdir}/builtins
89         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${headersdir}/include
90         ${SHELL} ${SUPPORT_SRC}mkinstalldirs ${DESTDIR}${pkgconfigdir}
92         # install-headers: install-headers-dirs
93         for hf in ${INSTALLED_HEADERS} ; do
94                 ${INSTALL_DATA} ${srcdir}/"$$hf" ${DESTDIR}${headersdir}/$$hf || exit 1;
95         done
96         for hf in ${INSTALLED_INCFILES} ; do
97                 ${INSTALL_DATA} ${BUSHINCDIR}/"$$hf" ${DESTDIR}${headersdir}/include/$$hf || exit 1;
98         done
99         for hf in ${INSTALLED_BUILTINS_HEADERS} ; do
100                 ${INSTALL_DATA} ${BUILTIN_SRCDIR}/"$$hf" ${DESTDIR}${headersdir}/builtins/$$hf || exit 1;
101         done
102         for hf in ${CREATED_HEADERS} ; do
103                 if test -f ${BUILD_DIR}/"$$hf" ; then
104                         ${INSTALL_DATA} ${BUILD_DIR}/"$$hf" ${DESTDIR}${headersdir}/$$hf || exit 1;
105                 else
106                         ${INSTALL_DATA} ${srcdir}/"$$hf" ${DESTDIR}${headersdir}/$$hf || exit 1;
107                 fi ;
108         done
109         ${INSTALL_DATA} ${SDIR}/bush.pc ${DESTDIR}${pkgconfigdir}/bush.pc
112 uninstall_hdrs ()
114         # uninstall-headers:
115         ( cd ${DESTDIR}${headersdir} && ${RM} ${INSTALLED_HEADERS} )
116         ( cd ${DESTDIR}${headersdir}/include && ${RM} ${INSTALLED_INCFILES} )
117         ( cd ${DESTDIR}${headersdir}/builtins && ${RM} ${INSTALLED_BUILTINS_HEADERS} )
118         ( cd ${DESTDIR}${headersdir} && ${RM} ${CREATED_HEADERS} )
119         ( ${RM} ${DESTDIR}${pkgconfigdir}/bush.pc )
122 clean ()
124         # basic-clean:
125         ${RM} .obj -rf
126         ${RM} ${OBJECTS} ${Program} bushbug
127         ${RM} .build .made src/version.h  mksignames bushversion
129         # clean:        basic-clean
130         ( cd ${DOCDIR} && ${MAKE} ${MFLAGS} clean )
131         ( cd builtins && ${MAKE} ${MFLAGS} clean )
132         ( cd ${SDIR} && ${MAKE} ${MFLAGS} clean )
133         for libdir in ${LIB_SUBDIRS}; do \
134                 (cd $$libdir && test -f Makefile && ${MAKE} ${MFLAGS} clean) ;
135         done
136         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} clean )
137         ( cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} clean )
138         ${RM} ${CREATED_SUPPORT}
142 distclean ()
144         # maybe-clean:
145         if test X"`cd ${topdir} && pwd -P`" != X"`cd ${BUILD_DIR} && pwd -P`" ; then
146                 ${RM} parser-built src/lxrgmr/y.tab.c src/lxrgmr/y.tab.h ;
147         fi
149         # mostlyclean: basic-clean
150         ( cd ${DOCDIR} && ${MAKE} ${MFLAGS} mostlyclean )
151         ( cd builtins && ${MAKE} ${MFLAGS} mostlyclean )
152         ( cd ${SDIR} && ${MAKE} ${MFLAGS) mostlyclean )
153         for libdir in ${LIB_SUBDIRS}; do
154                 (cd $$libdir && test -f Makefile && ${MAKE} ${MFLAGS} mostlyclean) ;
155         done
156         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} mostlyclean )
157         ( cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} mostlyclean )
159         # distclean:    basic-clean maybe-clean
160         ( cd ${DOCDIR} && ${MAKE} ${MFLAGS} distclean )
161         ( cd builtins && ${MAKE} ${MFLAGS} distclean )
162         ( cd ${SDIR} && ${MAKE} ${MFLAGS} distclean )
163         for libdir in ${LIB_SUBDIRS}; do
164                 (cd $$libdir && test -f Makefile && ${MAKE} ${MFLAGS} distclean) ;
165         done
166         ( cd ${PO_DIR} ; ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} distclean )
167         ( cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} DESTDIR=${DESTDIR} distclean )
168         ${RM} ${CREATED_CONFIGURE} tags TAGS 
169         ${RM} ${CREATED_SUPPORT} Makefile ${CREATED_MAKEFILES} src/pathnames.h
172 loadables ()
174         # 
175         cd ${LOADABLES_DIR} && ${MAKE} ${MFLAGS} all
178 strip ()
180         # strip:        ${Program} .made
181         ${STRIP} ${Program}
182         ls -l ${Program}
183         ${SIZE} ${Program}
186 tags ()
188         # TAGS: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
189         etags ${SOURCES} ${BUILTIN_C_SRC} ${LIBRARY_SOURCE}
191         # tags: $(SOURCES) $(BUILTIN_C_SRC) $(LIBRARY_SOURCE)
192         ctags -x ${SOURCES} ${BUILTIN_C_SRC} ${LIBRARY_SOURCE} > tags
195 lint ()
197         #       ${MAKE} ${MFLAGS} CFLAGS='${GCC_LINT_FLAGS}' .made
200 asan ()
202         #       ${MAKE} ${MFLAGS} ADDON_CFLAGS='${ASAN_XCFLAGS}' ADDON_LDFLAGS='${ASAN_XLDFLAGS}' .made
205 gcov ()
207         #       ${MAKE} ${MFLAGS} CFLAGS=-g ADDON_CFLAGS='${GCOV_XCFLAGS}' ADDON_LDFLAGS='${GCOV_XLDFLAGS}' .made
210 ###################################################################
212 prog_man2html ()
214         # $(SDIR)/man2html$(EXEEXT):    ${SUPPORT_SRC}/man2html.c
215         (cd ${SDIR} && ${MAKE} ${MFLAGS} all ) || exit 1
218 util_progs ()
220         # recho/zecho/printenv/xcase/hashtest
221         
222         # recho$(EXEEXT):               $(SUPPORT_SRC)recho.c
223         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD}
225         # zecho$(EXEEXT):               $(SUPPORT_SRC)zecho.c
226         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD}
228         # printenv$(EXEEXT):    $(SUPPORT_SRC)printenv.c
229         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD}
231         # xcase$(EXEEXT):       $(SUPPORT_SRC)xcase.c
232         @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)xcase.c ${LIBS_FOR_BUILD}
234         # hashtest:     src/hashlib.c
235         $(CC) -DTEST_HASHING $(CCFLAGS) $(TEST_NBUCKETS) -o $@ $(srcdir)/src/hashlib.c xmalloc.o $(INTL_LIB) $(MALLOC_LIBRARY)
239 ###################################################################
241 asan_tests ()
243         # asan-tests: asan  $(TESTS_SUPPORT)
244         @test -d tests || mkdir tests
245         cp ${TESTS_SUPPORT} tests
246         ( cd ${srcdir}/tests && \
247                 BUILD_DIR=${BUILD_DIR} PATH=${BUILD_DIR}/tests:$$PATH THIS_SH=${THIS_SH} ${SHELL} ${TESTSCRIPT} )
250 profiling_tests ()
252         # profiling-tests:      ${PROGRAM}
253         test "X$$PROFILE_FLAGS" == "X" && { echo "profiling-tests: must be built with profiling enabled" >&2; exit 1; }
254         ${MAKE} ${MFLAGS} tests TESTSCRIPT=run-gprof
257 test ()
259         # test tests check:     force $(Program) $(TESTS_SUPPORT)
260         @-test -d tests || mkdir tests
261         @cp $(TESTS_SUPPORT) tests
262         @( cd $(srcdir)/tests && \
263                 BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} )
266 ###################################################################
268 dist ()
270         # dist: force
271         @echo Bush distributions are created using $(srcdir)/support/mkdist.
272         @echo Here is a sample of the necessary commands:
273         @echo $(Program) $(srcdir)/support/mkdist -m $(srcdir)/MANIFEST -s $(srcdir) -r ${PACKAGE} -t $(PACKAGE_VERSION)
276 xdist ()
278         # xdist:        force
279         ( cd $(DOCDIR) && $(MAKE) $(MFLAGS) $@ )
280         ( cd po && $(MAKE) $(MFLAGS) $@ ) 
283 depends ()
285         # depend:       depends
287         # depends: force
288         @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
289         $(Program) $(SUPPORT_SRC)mkdep -c ${CC} -- ${CCFLAGS} ${CSOURCES}