source: CMT/HEAD/mgr/fragments/constituent_lock @ 588

Last change on this file since 588 was 588, checked in by rybkin, 13 years ago

See C.L. 465

File size: 7.2 KB
Line 
1#-- start of constituent_lock ------
2
3cmt_${CONSTITUENT}_${HASTARGETTAG} = 1
4
5#--------------------------------------------------------
6
7ifdef cmt_${CONSTITUENT}_has_target_tag
8
9#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag)_${CONSTITUENT}.make
10cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag)_${CONSTITUENT}.make
11cmt_local_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}$$$$.make
12cmt_final_setup_${CONSTITUENT} = $(bin)setup_${CONSTITUENT}.make
13#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}_${CONSTITUENT}setup.make
14cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
15
16${CONSTITUENT}_extratags = -tag_add=target_${CONSTITUENT}
17
18#$(cmt_local_tagfile_${CONSTITUENT}) : $(cmt_lock_setup)
19ifndef QUICK
20$(cmt_local_tagfile_${CONSTITUENT}) ::
21else
22$(cmt_local_tagfile_${CONSTITUENT}) :
23endif
24        $(echo) "(constituents.make) Rebuilding $@"; \
25          if test -f $(cmt_local_tagfile_${CONSTITUENT}); then /bin/rm -f $(cmt_local_tagfile_${CONSTITUENT}); fi ; \
26          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build tag_makefile >>$(cmt_local_tagfile_${CONSTITUENT})
27        $(echo) "(constituents.make) Rebuilding $(cmt_final_setup_${CONSTITUENT})"; \
28          test ! -f $(cmt_local_setup_${CONSTITUENT}) || \rm -f $(cmt_local_setup_${CONSTITUENT}); \
29          trap '\rm -f $(cmt_local_setup_${CONSTITUENT})' 0 1 2 15; \
30          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) show setup >$(cmt_local_setup_${CONSTITUENT}) && \
31          if [ -f $(cmt_final_setup_${CONSTITUENT}) ] && \
32            \cmp -s $(cmt_final_setup_${CONSTITUENT}) $(cmt_local_setup_${CONSTITUENT}); then \
33            \rm $(cmt_local_setup_${CONSTITUENT}); else \
34            \mv -f $(cmt_local_setup_${CONSTITUENT}) $(cmt_final_setup_${CONSTITUENT}); fi
35
36else
37
38#cmt_local_tagfile_${CONSTITUENT} = $(${PACKAGE}_tag).make
39cmt_local_tagfile_${CONSTITUENT} = $(bin)$(${PACKAGE}_tag).make
40cmt_final_setup_${CONSTITUENT} = $(bin)setup.make
41#cmt_final_setup_${CONSTITUENT} = $(bin)${PACKAGE}setup.make
42cmt_local_${CONSTITUENT}_makefile = $(bin)${CONSTITUENT}.make
43
44endif
45
46not_${CONSTITUENT}_dependencies = { n=0; for p in $?; do m=0; for d in $(${CONSTITUENT}_dependencies); do if [ $$p = $$d ]; then m=1; break; fi; done; if [ $$m -eq 0 ]; then n=1; break; fi; done; [ $$n -eq 1 ]; }
47
48ifdef STRUCTURED_OUTPUT
49${CONSTITUENT}dirs :
50        @if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
51        $(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
52else
53${CONSTITUENT}dirs : ;
54endif
55
56#ifndef QUICK
57#ifdef STRUCTURED_OUTPUT
58# ${CONSTITUENT}dirs ::
59#       @if test ! -d $(bin)${CONSTITUENT}; then $(mkdir) -p $(bin)${CONSTITUENT}; fi
60#       $(echo) "STRUCTURED_OUTPUT="$(bin)${CONSTITUENT}
61#
62#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs ${CONSTITUENT}dirs
63#else
64#$(cmt_local_${CONSTITUENT}_makefile) :: $(${CONSTITUENT}_dependencies) $(cmt_local_tagfile_${CONSTITUENT}) build_library_links dirs
65#endif
66#else
67#$(cmt_local_${CONSTITUENT}_makefile) :: $(cmt_local_tagfile_${CONSTITUENT})
68#endif
69
70ifdef cmt_${CONSTITUENT}_has_target_tag
71
72ifndef QUICK
73$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) build_library_links
74        $(echo) "(constituents.make) Building ${CONSTITUENT}.make"; \
75          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
76else
77$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) $(cmt_build_library_linksstamp) $(use_requirements)
78        @if [ ! -f $@ ] || [ ! -f $(cmt_local_tagfile_${CONSTITUENT}) ] || \
79          [ ! -f $(cmt_final_setup_${CONSTITUENT}) ] || \
80          $(not_${CONSTITUENT}_dependencies) ; then \
81          test -z "$(cmtmsg)" || \
82          echo "$(CMTMSGPREFIX)" "(constituents.make) Building ${CONSTITUENT}.make"; \
83          $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_config -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
84          fi
85endif
86
87else
88
89ifndef QUICK
90$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) build_library_links
91        $(echo) "(constituents.make) Building ${CONSTITUENT}.make"; \
92          $(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -without_cmt -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
93else
94$(cmt_local_${CONSTITUENT}_makefile) : $(${CONSTITUENT}_dependencies) $(cmt_build_library_linksstamp) $(bin)${CONSTITUENT}.in
95        @if [ ! -f $@ ] || [ ! -f $(cmt_local_tagfile_${CONSTITUENT}) ] || \
96          [ ! -f $(cmt_final_setup_${CONSTITUENT}) ] || \
97          $(not_${CONSTITUENT}_dependencies) ; then \
98          test -z "$(cmtmsg)" || \
99          echo "$(CMTMSGPREFIX)" "(constituents.make) Building ${CONSTITUENT}.make"; \
100          $(cmtexe) -f=$(bin)${CONSTITUENT}.in -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -without_cmt -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
101          fi
102endif
103
104endif
105
106#         $(cmtexe) -tag=$(tags) $(${CONSTITUENT}_extratags) build constituent_makefile -out=$(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}
107
108${CONSTITUENT} :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile) dirs ${CONSTITUENT}dirs
109        $(echo) "(constituents.make) Creating ${CONSTITUENT}${lock_suffix} and Starting ${CONSTITUENT}"
110        @${lock_command} ${CONSTITUENT}${lock_suffix} || exit $$?; \
111          retval=$$?; \
112          trap '${unlock_command} ${CONSTITUENT}${lock_suffix}; exit $${retval}' 1 2 15; \
113          if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
114          $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}; \
115          fi; \
116          retval=$$?; ${unlock_command} ${CONSTITUENT}${lock_suffix}; exit $${retval}
117        $(echo) "(constituents.make) ${CONSTITUENT} done"
118
119clean :: ${CONSTITUENT}clean
120
121${CONSTITUENT}clean :: $(${CONSTITUENT}clean_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
122        $(echo) "(constituents.make) Starting ${CONSTITUENT}clean"
123        @-if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
124          $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}clean; \
125        fi
126        $(echo) "(constituents.make) ${CONSTITUENT}clean done"
127#       @-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) ${CONSTITUENT}clean
128
129##        /bin/rm -f $(cmt_local_${CONSTITUENT}_makefile) $(bin)${CONSTITUENT}_dependencies.make
130
131install :: ${CONSTITUENT}install
132
133${CONSTITUENT}install :: $(${CONSTITUENT}_dependencies) $(cmt_local_${CONSTITUENT}_makefile)
134        $(echo) "(constituents.make) Starting install ${CONSTITUENT}"
135        @-$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) install
136        $(echo) "(constituents.make) install ${CONSTITUENT} done"
137
138uninstall : ${CONSTITUENT}uninstall
139
140$(foreach d,$(${CONSTITUENT}_dependencies),$(eval $(d)uninstall_dependencies += ${CONSTITUENT}uninstall))
141
142${CONSTITUENT}uninstall : $(${CONSTITUENT}uninstall_dependencies) ##$(cmt_local_${CONSTITUENT}_makefile)
143        $(echo) "(constituents.make) Starting uninstall ${CONSTITUENT}"
144        @if test -f $(cmt_local_${CONSTITUENT}_makefile); then \
145          $(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) uninstall; \
146          fi
147#       @$(MAKE) -f $(cmt_local_${CONSTITUENT}_makefile) uninstall
148        $(echo) "(constituents.make) uninstall ${CONSTITUENT} done"
149
150remove_library_links :: ${CONSTITUENT}uninstall
151
152ifndef PEDANTIC
153.DEFAULT::
154        $(echo) "(constituents.make) Starting $@ ${CONSTITUENT}"
155        $(echo) Using default action for $@
156        $(echo) "(constituents.make) $@ ${CONSTITUENT} done"
157endif
158
159#-- end of constituent_lock ------
Note: See TracBrowser for help on using the repository browser.