summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/proposal/lib/Makefile.ctan
blob: d24d524aa6a0fc2a969dca3f993fd3694ce8782a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
################################################################
# make a zip for CTAN submission including the TeX directory structure.
#
# The overall procedure is to run make in this directory $(HERE) and then
# export it to a temporary directory $(EXPORTED) without all the generated
# files. On this directory we run "make ctanext" (see below) which makes a
# CTAN-compliant directory structure, and zips it up to the file
# <package>.ctan.zip which can be submitted to the CTAN maintainers.
#
# Note that part of the CTAN submission is a zip file with a TDS-compliant
# directory struture, which is generated by running "make tdsext" (see below)
# on $(EXPORTED).
#
# Note furthermore, that this Makefile only automates the top-level mechanics
# of the CTAN zip files, ... It relies on the Variables set in the regular Makefiles
# and in particular on their targets "ltds", "lctan", "filedate", and "checksum". 
################################################################

HERE   	        = $(shell pwd)
GITREPOS	  	= $(HERE)
REPOSNAME	= LaTeX-proposal
TMP    	        = /tmp
#TDSCOLL 	?= $(shell basename $$PWD)
TDSCOLL 	= proposal
EXPORTED	= $(TMP)/$(TDSCOLL).exp

TDS.dir             = $(TDSCOLL).tds
TDSDIR 		= $(TMP)/$(TDS.dir)
TDS.zip		= $(TDS.dir).zip	
TDSZIP 		= $(TMP)/$(TDS.zip)

CTANDIR 	= $(TMP)/$(TDSCOLL)
CTAN.zip	        = $(TDSCOLL).ctan.zip 
CTANZIP		= $(TMP)/$(CTAN.zip)

MAKE		= make

# this target makes the file CTANZIP by creating and populating the directory 
# CTANDIR and zipping it. To be current, we first make all, and update 
# the filedates and the checksums. To get rid of all the junk we commit and 
# export a clean copy EXPORTED, on which we run the target ctanexp below,  
# which generates a directory CTANDIR, which we zip and move into place. 
ctan: all  filedate checksum
	git commit -am'draining just to be sure for CTAN distribution' --allow-empty
	rm -Rf $(EXPORTED)
	@echo "exporting a clean copy to $(EXPORTED)"
	cd $(TMP);rm -Rf $(REPOSNAME);git clone $(GITREPOS);mv $(REPOSNAME) $(EXPORTED)
	rm -Rf $(EXPORTED)/.git
	find $(EXPORTED) -name ".gitignore" -delete
	cd $(EXPORTED);$(MAKE) -$(MAKEFLAGS) ctanext
	@echo "zipping the result to $(TDSCOLL).ctan.zip"
	cd $(TMP);zip -r $(CTANZIP) $(TDS.zip) $(TDSCOLL);cp $(CTANZIP) $(HERE)
	@echo "cleaning up"   
	rm -Rf $(EXPORTED) $(CTANDIR) $(CTANZIP) $(TDSZIP)
	@echo "disabling checksums again for further development"
	$(MAKE) -$(MAKEFLAGS) disablechecksum

# this target is run on EXPORTED. It first makes the target tdsext below, 
# and then copies all necessary stuff into CTANDIR. 
ctanext: tdsext
	@echo "making a CTAN compliant archive in $(CTANDIR)"
	rm -Rf $(CTANDIR) $(CTANZIP)
	mkdir -p $(CTANDIR)
	@echo "  copying material from $(EXPORTED) to $(CTANDIR)"
	@for d in $(DTXDIRS); do (cd $$d && $(MAKE) -$(MAKEFLAGS) lctan) done
	@for d in $(SRCDIRS) $(DOCDIRS); do (cp -R $$d $(CTANDIR)) done; 
	@for d in $(SRCFILES); do (cp -p $$d $(CTANDIR)) done; 
	cp $(TDS.README) $(CTANDIR)/README

# this target makes the file TDSZIP by creating and populating the directory 
# TDSDIR and zipping it. 
tdsext: 
	@echo "making a TDS compliant archive"
	rm -Rf $(TDSDIR) $(TDSZIP)
	@echo "  enabling checksums"
	$(MAKE) -$(MAKEFLAGS) enablechecksum
	@echo "  copying LaTeX Sources to $(TDSDIR)"
	@for d in $(DTXDIRS); do (cd $$d && $(MAKE) -$(MAKEFLAGS) ltds) done
	@echo "  copying binary dir to $(TDSDIR)"
	@for d in $(SRCDIRS); do (cp -R $$d $(TDSDIR)/source/latex/$(TDSCOLL)) done; 
	@for d in $(SRCFILES); do (cp -R $$d $(TDSDIR)/source/latex/$(TDSCOLL)) done; 
	@echo "  copying documentation to $(TDSDIR)"
	@for d in $(DOCDIRS); do (cp -R $$d $(TDSDIR)/doc/latex/$(TDSCOLL)) done; 
	@for d in $(TDS.doc); do (cp -R $$d $(TDSDIR)/doc/latex/$(TDSCOLL)) done;
	@echo "zipping the result to $(TDSCOLL).tds.zip"
	cd $(TDSDIR);zip -r -q $(TDSZIP) .
	@echo "and removing the temporary directory $(TDSDIR)"
	rm -Rf $(TDSDIR)