/ [latex-makedtx] / trunk / Makefile
To checkout: svn checkout http://svn.gnu.org.ua/sources/latex-makedtx/trunk/Makefile
Puszcza

Contents of /trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (show annotations)
Thu Feb 22 04:47:40 2018 UTC (3 years, 7 months ago) by vincentb1
File size: 6342 byte(s)
Fix makedtx.tds.zip archiviing for CTAN

* Makefile (makedtx.tds.zip): Place makedtx.tds.zip at the right
place --- ie root --- in makedtx.zip

1 PKG:=makedtx
2 DOC:=doc/support/$(PKG)
3 DIST:=../dist
4 ANTI_DIST:=../trunk
5 ANTI_DOC:=../../..
6 ANTI_TEX:=../../..
7 TEX:=tex/latex/$(PKG)
8 SCRIPTS:=scripts/$(PKG)
9 ANTI_SCRIPTS:=../..
10 READMEFILE:=README.txt
11 # Set to 0 to bypass check_vc target
12 CHECK_VC_STATUS?=-1
13 MAKELEVELBASE?=0
14 MAKEDTX:=scripts/makedtx/makedtx
15 # .ins must be in first place
16 DTXFILES:=$(PKG).ins $(PKG).dtx
17 DTXSOURCE:=$(DIST)/dtxsource
18 ANTI_DTXSOURCE:=../$(ANTI_DIST)
19 DOCFILES:=CHANGES.org $(PKG).tex $(PKG)-version.tex $(READMEFILE) latexmkrc.pl
20 CTANTAG?=svn copy svn+ssh://vincentb1@svn.gnu.org.ua/latex-makedtx/trunk svn+ssh://vincentb1@svn.gnu.org.ua/latex-makedtx/tags/ctan$(VERSION) -m "CTAN delivery $(DATE)"
21
22 PACKED_DOCFILES:=$(DOCFILES)
23 $(foreach EXCLUDE,$(PKG).tex $(READMEFILE),\
24 $(eval PACKED_DOCFILES:=$(filter-out $(EXCLUDE),$(PACKED_DOCFILES))))
25
26
27 FILES:=$(DOCFILES) $(PKG).pl createdtx.sty
28 DIRS:=$(addprefix tds/,$(DOC) $(TEX) $(SCRIPTS) source/makedtx) $(PKG) dtxsource
29
30 ifeq ($(USERNAME)@$(COMPUTERNAME),Vincent@AIGLEROYAL)
31 AUTHOR:=--author 'Nicola L.C. Talbot'
32 endif
33
34 .PHONY: dist
35 dist: $(addprefix $(DIST)/,$(DTXFILES))
36
37 .PHONY: ctan
38 ctan: check_vc $(DIST)/$(PKG).zip
39
40 .PHONY: test
41 test:
42 $(MAKE) -C test
43
44 $(addprefix $(DIST)/,$(DTXFILES)) : $(addprefix $(DTXSOURCE)/,$(DOCFILES) $(PKG).pl createdtx.sty) $(DTXSOURCE)
45 cd $(DTXSOURCE); \
46 $(ANTI_DTXSOURCE)/$(MAKEDTX) -v --macrocode 'makedtx\.pl$$' \
47 --comment 'makedtx\.pl$$' \
48 $(foreach DF,$(PACKED_DOCFILES), \
49 --src '$(subst .,\.,$(DF))$$=>$(DF)' \
50 --macrocode '$(subst .,\.,$(DF))$$' \
51 --comment '$(subst .,\.,$(DF))$$' \
52 ) \
53 --src 'createdtx\.sty$$=>createdtx.sty' \
54 --src 'makedtx\.pl$$=>makedtx.pl' \
55 --doc makedtx.tex \
56 --setamble '\.pl$$=>\nopreamble\nopostamble' \
57 $(AUTHOR) \
58 makedtx
59 $(foreach DF,$(DTXFILES),mv $(DTXSOURCE)/$(DF) $(DIST);)
60
61 $(DTXSOURCE)/createdtx.sty: $(TEX)/createdtx.sty $(DTXSOURCE)
62 if [ -f $@ ]; then rm $@; fi
63 cd $(DTXSOURCE); ln -s $(ANTI_DTXSOURCE)/$(TEX)/createdtx.sty createdtx.sty
64
65 $(addprefix $(DTXSOURCE)/,$(DOCFILES)): $(DTXSOURCE)/%: $(DOC)/% $(DTXSOURCE)
66 if [ -f $@ ]; then rm $@; fi
67 cd $(DTXSOURCE); ln -s $(ANTI_DTXSOURCE)/$< $(notdir $@)
68
69 $(DTXSOURCE)/$(PKG).pl: $(DTXSOURCE)/%.pl: $(SCRIPTS)/% $(DTXSOURCE)
70 if [ -f $@ ]; then rm $@; fi
71 cd $(DTXSOURCE); ln -s $(ANTI_DTXSOURCE)/$< $(notdir $@)
72
73
74 $(addprefix $(DIST)/dtxsource/,$(DOCFILES) $(notdir $(MAKEDTX)) createdtx.sty): $(addprefix $(DOC)/,$(DOCFILES)) $(MAKEDTX) $(TEX)/createdtx.sty
75
76
77 $(addprefix $(DIST)/,$(FILES)): $(addprefix $(DIST)/,$(DTXFILES))
78 cd $(DIST); latex --interaction=nonstopmode $(notdir $<)
79
80 $(DIST)/makedtx.pdf: $(addprefix $(DIST)/,latexmkrc.pl makedtx.dtx)
81 cd $(DIST); latexmk -r latexmkrc.pl makedtx.dtx
82
83
84 # We have to go through this macro because under MSW the symlink
85 # emulation by MSYS2 is a little clumsy. Even when native symlinks are
86 # enabled, MSYS2 make does not handle time stamps wisely with symlinks.
87 # $(1) = target
88 # $(2) = link name
89 define LN_S
90 target=$(1); name=$(2); \
91 if [ -f $$name ]; then \
92 if [ $$name -ot $$target ]; then \
93 rm $$name; \
94 ln -s $$target $$name; \
95 fi; \
96 else \
97 ln -s $$target $$name; \
98 fi
99 endef
100
101 $(DIST)/makedtx.zip: $(addprefix $(DIST)/,$(DTXFILES) makedtx.pdf makedtx.tds.zip) $(DOC)/$(READMEFILE)
102 cd $(DIST)/$(PKG); \
103 for w in makedtx.pdf $(DTXFILES); do $(call LN_S,../$$w,$$w); done; \
104 $(call LN_S,../$(ANTI_DIST)/$(DOC)/$(READMEFILE),$(READMEFILE))
105 cd $(DIST); \
106 zip -r $(PKG).zip $(PKG) $(PKG).tds.zip; \
107 ls -l $(PKG).zip; \
108 unzip -t $(PKG).zip
109
110
111 $(DIST)/makedtx.tds.zip: $(addprefix $(DIST)/,$(DIRS))
112 cd $(DIST)/tds/$(DOC); for w in $$(find $(ANTI_DOC)/../$(ANTI_DIST)/$(DOC) \
113 '(' -false $(patsubst %,-o -iname '%',$(DOCFILES)) ')' -print); do \
114 $(call LN_S,$$w,$$(basename $$w)); \
115 done
116 cd $(DIST)/tds/$(TEX); $(call LN_S,$(ANTI_TEX)/../$(ANTI_DIST)/$(TEX)/createdtx.sty,createdtx.sty)
117 cd $(DIST)/tds/$(SCRIPTS); \
118 $(call LN_S,$(ANTI_SCRIPTS)/../$(ANTI_DIST)/$(SCRIPTS)/makedtx,makedtx)
119 cd $(DIST)/tds/source/$(PKG); \
120 trim_left=$$(expr 2 + $$(echo -n "../../../$(ANTI_DIST)"| wc -m)); \
121 for w in $$(find ../../../$(ANTI_DIST) -type f '(' \
122 -iname '$(PKG)-version.tex' ')' -prune -o -type f '(' \
123 -iname '*.tex' -o -iname '*.sty' -o -iname '*.org' \
124 -o -iname '*.m4' -o -iname Makefile \
125 ')' -print); do \
126 dir=$$(dirname $$(echo $$w | cut -c $${trim_left}-)); \
127 mkdir -p $$dir; \
128 if [ "$$dir" == . ]; then \
129 $(call LN_S,$$w,$$(basename $$w)); \
130 else \
131 pushd $$dir >/dev/null; \
132 $(call LN_S,$$(echo -n $$dir | sed 's![^/]\+!..!g')/$$w,$$(basename $$w)); \
133 popd >/dev/null; \
134 fi; \
135 done
136 cd $(DIST)/tds; zip -r $(PKG).tds.zip $$(ls)
137 mv $(DIST)/tds/$(PKG).tds.zip $(DIST)
138
139 $(addprefix $(DIST)/,$(DIRS)):%:
140 mkdir -p $@
141
142 $(DOC)/$(PKG)-version.tex: $(MAKEDTX)
143 $(MAKE) -C $(DOC) $(notdir $@)
144
145 .PHONY: doc
146 doc: $(DOC)/$(PKG).pdf
147
148 $(DOC)/$(PKG).pdf: $(addprefix $(DOC)/,$(PKG).tex $(PKG)-version.tex)
149 $(MAKE) -C $(DOC) $(notdir $@)
150
151 $(DOC)/$(READMEFILE): $(DOC)/README-org.m4 $(MAKEDTX)
152 $(MAKE) -C $(DOC) $(notdir $@)
153
154 .PHONY: clean
155 clean:
156 rm -fr $(addprefix $(DIST)/,$(PKG) tds)
157 $(MAKE) -C $(DOC) clean
158 $(MAKE) -C test clean
159
160 .PHONY: realclean
161 realclean: clean
162 rm -fr $(DIST)
163 $(MAKE) -C $(DOC) realclean
164 $(MAKE) -C test realclean
165
166
167 # Check that everything is committed
168 .PHONY: check_vc
169 check_vc:
170 @if svn status | awk 'BEGIN { es=1; }; /^[MAC] / { es=0; }; END { exit(es) }'; \
171 then \
172 echo 'Uncommitted changes, use ``make [target] CHECK_VC_STATUS=0'"''"' to force make.' 2> /dev/stderr; \
173 exit $(CHECK_VC_STATUS); \
174 fi
175
176
177 .PHONY: ctantag
178 ctantag: check_vc scripts/makedtx/makedtx doc/support/makedtx/makedtx.tex
179 ifeq ($(MAKELEVEL),$(MAKELEVELBASE))
180 @$(MAKE) $@ \
181 VERSION=$(shell perl scripts/makedtx/makedtx --version | sed -e 's/makedtx version \([0-9]\+\.[0-9]\+[a-z]*\)/\1/1' ) \
182 DATE=$(shell awk 'BEGIN { FS="[{}]" }; /^ *\\DTMsavedate{makedtx-date}/ { print $$4; exit}' doc/support/makedtx/makedtx.tex)
183 else
184 @echo 'Do the following command:'
185 @echo '$(CTANTAG)'
186 @select w in oui non; \
187 do \
188 case $$w in \
189 oui) \
190 $(CTANTAG); \
191 break;; \
192 non) \
193 echo 'abandon'; \
194 break;; \
195 esac; \
196 done
197 endif

Send suggestions and bug reports to Sergey Poznyakoff
ViewVC Help
Powered by ViewVC 1.1.20