Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / doc / guide / Makefile
blob5ca94599f6b8c055087f90eba5e1f8fdc48615f9
1 # $NetBSD: Makefile,v 1.38 2011/12/01 22:23:33 minskim Exp $
4 DISTNAME= pkgsrc-guide-${PKGVERSION}
5 CATEGORIES= # empty
6 MASTER_SITES= ${MASTER_SITE_LOCAL}
7 DISTFILES= htdocs-share-20111201.tar.gz
9 MAINTAINER= pkgsrc-users@NetBSD.org
10 HOMEPAGE= http://www.NetBSD.org/docs/pkgsrc/
11 COMMENT= The pkgsrc guide
13 # To regenerate pkgsrc/doc/pkgsrc.{html,txt} and
14 # htdocs/docs/pkgsrc, just run "make regen".
16 PKGVERSION!= date '+%Y%m%d'
17 DIST_SUBDIR= ${PKGBASE}
18 USE_LANGUAGES= # empty
19 MAKE_ENV+= SED=${SED:Q}
21 PLIST_VARS= ascii html pdf
23 DOCDIR= ${PREFIX}/share/doc/pkgsrc
24 .if exists(/usr/cvs/htdocs)
25 HTDOCSDIR?= /usr/cvs/htdocs
26 .endif
27 HTDOCSDIR?= ${.CURDIR}/../../../htdocs
29 BUILD_DEFS+= OUTPUTS
30 OUTPUTS?= lint html html-split ascii pdf
32 INSTALLATION_DIRS= ${DOCDIR}
34 .if defined(OUTPUTS)
35 . if !empty(OUTPUTS:Mascii)
36 # the html is needed to build the ascii version.
37 OUTPUTS+= html
38 PLIST.ascii= yes
39 . endif
41 . if !empty(OUTPUTS:Mhtml) || !empty(OUTPUTS:Mhtml-split)
42 PLIST.html= yes
43 .endif
45 . if !empty(OUTPUTS:Mpdf)
46 PLIST.pdf= yes
47 .endif
49 # only override the Makefile.common default if it is explicitly set
50 _GUIDE_OUTPUTS= ${OUTPUTS}
51 .endif
53 .include "Makefile.common"
55 # The source files are only symlinked into the WRKSRC, so that they can
56 # be easily modified, should the "lint" phase fail.
57 pre-extract:
58 ${MKDIR} ${WRKSRC}
59 ${LN} -s ${FILESDIR}/* ${WRKSRC}
61 do-build:
62 .for _output_ in ${OUTPUTS}
63 @${ECHO} "-----> Building ${_output_} output"
64 @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${_output_}
65 .endfor
67 post-build:
68 @${RM} -f ${WRKSRC}/pkgsrc.tmp.html
70 do-install:
71 .if !empty(OUTPUTS:Mhtml) || !empty(OUTPUTS:Mhtml-split)
72 ${INSTALL_DATA} ${WRKSRC}/*.html ${DESTDIR}${DOCDIR}
73 ${INSTALL_DATA} ${WRKDIR}/htdocs/global.css ${DESTDIR}${DOCDIR}
74 .endif
75 .if !empty(OUTPUTS:Mascii)
76 ${INSTALL_DATA} ${WRKSRC}/pkgsrc.txt ${DESTDIR}${DOCDIR}
77 .endif
78 .if !empty(OUTPUTS:Mpdf)
79 ${INSTALL_DATA} ${WRKSRC}/pkgsrc.ps ${DESTDIR}${DOCDIR}
80 ${INSTALL_DATA} ${WRKSRC}/pkgsrc.pdf ${DESTDIR}${DOCDIR}
81 .endif
83 # install the single-file HTML and ascii output into the pkgsrc doc/
84 # directory, for distribution with pkgsrc.
86 # note that this uses ${CP} and not ${INSTALL_DATA} because the files
87 # stay in the development directories and have nothing to do with
88 # the permissions or ownership of installed files.
90 install-doc: build
91 ${CP} ${WRKSRC}/pkgsrc.html ${PKGSRCDIR}/doc
92 ${CP} ${WRKSRC}/pkgsrc.txt ${PKGSRCDIR}/doc
94 install-htdocs: build
95 cd ${WRKSRC} && ${CP} pkgsrc.txt pkgsrc.pdf pkgsrc.ps *.html \
96 ${HTDOCSDIR}/docs/pkgsrc
98 .PHONY: regen regen-doc regen-htdocs
99 regen: regen-doc regen-htdocs
101 regen-doc: build
102 @${STEP_MSG} "Updating the files in pkgsrc/doc"
103 cd .. && cvs update pkgsrc.*
104 ${MAKE} ${MAKEFLAGS} install-doc
105 @${STEP_MSG} "Committing the files in pkgsrc/doc"
106 cd .. && cvs commit -m "regen" pkgsrc.*
108 regen-htdocs: build
109 @${STEP_MSG} "Updating the files in htdocs"
110 cd ${HTDOCSDIR}/docs/pkgsrc && cvs update
111 ${MAKE} ${MAKEFLAGS} install-htdocs
112 @${STEP_MSG} "Committing the files in htdocs"
113 cd ${HTDOCSDIR}/docs/pkgsrc && cvs commit -m "regen"
115 do-lint:
116 cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} lint
118 DETAB_PROGRAM= \
119 if (/<programlisting>/ .. /<\/programlisting>/) { \
120 while (/(.*?)\t(.*)/s) { \
121 my $$filler = " " x (8 - (length($$1) % 8)); \
122 $$_ = "$$1$$filler$$2"; \
126 # remove tabulators from the <programlisting> tags.
127 # TeX does not like them.
128 .PHONY: detab
129 detab:
130 cd ${FILESDIR} && \
131 perl -p -i".detab.tmp" -e '${DETAB_PROGRAM}' *.xml && \
132 ${RM} -f *.xml.detab.tmp
134 # Generates a new htdocs-share-*.tar.gz archive from the current
135 # contents of the htdocs directory. To make it available, it should
136 # be copied to ftp.NetBSD.org/pub/pkgsrc/distfiles/LOCAL_PORTS/.
137 .PHONY: htdocs-share
138 htdocs-share:
139 cd ${HTDOCSDIR} \
140 && ${PAX} -wz -f ${.CURDIR}/htdocs-share-${PKGVERSION}.tar.gz \
141 -s ',^,htdocs/,' \
142 global.css share
144 .include "../../mk/bsd.pkg.mk"