Sync our gcc5 manual pages with gcc-5.4.0
[dragonfly.git] / etc / Makefile.usr
CommitLineData
95f63bef 1# Makefile.usr - installed as /usr/Makefile
809ae383 2#
df16f41a 3# Provides simple targets to download and maintain /usr/src, /usr/dports etc.
809ae383 4
fe70af21 5GITHOST?=git.dragonflybsd.org
3d88cbf2 6GITHOST_DPORTS?=mirror-master.dragonflybsd.org
fe70af21 7
4060abb3 8DPTBALL=/tmp/dports.tar.gz
3271cef5 9PKGBALL=/tmp/pkgboot.tar.xz
898339da 10DPDLURL=https://api.github.com/repos/DragonFlyBSD/DPorts/tarball/
daa5ccc1 11PKGBOOT_VERSION=02
937aaebf 12PKGBOOT_x86_64=bootstrap_pkg_${PKGBOOT_VERSION}_x86-64.tar.xz
f201b797 13PKGBOOT=http://mirror-master.dragonflybsd.org/dports/bootstraps/${PKGBOOT_${MACHINE_ARCH}}
9c71144e 14ERRPKG="Error: Bootstrap not necessary, ${.CURDIR}/local/sbin/pkg already exists"
4060abb3
JM
15WSTARS="***************************************************************"
16WARNPS=" Warning: Delete or move ${.CURDIR}/pkg before building any dport!"
17LPATT=" make %-23s- %s\n"
18
e2dbfa0b 19help all:
4922fbd1 20 @echo "HELP:"
4060abb3
JM
21 @echo
22.if exists(${.CURDIR}/dports/.git)
0b576dae 23 @printf ${LPATT} "dports-update" "update your dports repository from the net"
4922fbd1 24.else
4060abb3 25. if exists(${.CURDIR}/dports)
0b576dae 26 @printf ${LPATT} "dports-replace" "Replace dports with latest tarball (Github)"
4060abb3 27. else
0b576dae 28 @printf ${LPATT} "dports-create" "fetch initial dports repository from the net"
4060abb3 29 @printf ${LPATT} "dports-create-shallow" "fetch initial history-free dports repository"
0b576dae 30 @printf ${LPATT} "dports-download" "download & install dports tarball (Github)"
4060abb3 31. endif
3271cef5 32.endif
3271cef5 33 @printf ${LPATT} "pkg-bootstrap" "Use pre-built pkg to install dports packages"
f201b797 34 @printf ${LPATT} "pkg-bootstrap-force" "Force it (pkg.conf will be overwritten)"
4060abb3
JM
35 @echo
36
4922fbd1
MD
37.if exists(${.CURDIR}/src/.git)
38.if exists(${.CURDIR}/src/Makefile)
4060abb3 39 @printf ${LPATT} "src-update" "update your src repository from the net"
4922fbd1 40.else
4060abb3 41 @printf ${LPATT} "src-checkout" "Initial checkout of src repository"
4922fbd1
MD
42.endif
43.else
4060abb3
JM
44 @printf ${LPATT} "src-create" "fetch initial src repository from the net"
45 @printf ${LPATT} "src-create-shallow" "fetch initial history-free src repository"
46 @printf ${LPATT} "src-create-repo" "fetch src repository only, no checkout"
4922fbd1 47.endif
4060abb3 48 @echo
9effbeff 49.if exists(${.CURDIR}/src-sys.tar.bz2)
4060abb3
JM
50 @printf ${LPATT} "release-sys-extract" "extract the pre-packaged sys-only sources"
51 @echo
4922fbd1 52.endif
4922fbd1 53 @echo "If automating please feel free to run git pull's from cron."
4060abb3 54 @echo "We prefer once a day but you can run them more often if you desire"
4922fbd1 55
fff08b59
AHJ
56git-check:
57 @/usr/bin/which -s git || \
58 (echo "git must be present on the system to use this option."; /usr/bin/false)
59
60src-check: git-check
61 @/bin/test ! -d ${.CURDIR}/src/.git || \
62 (echo "Error: ${.CURDIR}/src already exists"; /usr/bin/false)
63
64src-check-hasdir: git-check
65 @/bin/test -d ${.CURDIR}/src/.git || \
66 (echo "Error: ${.CURDIR}/src does not exist"; /usr/bin/false)
67
68src-create-repo: src-check
4922fbd1 69 @echo "If problems occur you may have to rm -rf src and try again."
4060abb3 70 @echo
fff08b59
AHJ
71 @mkdir -p ${.CURDIR}/src
72 @cd ${.CURDIR}/src && git init
73 @cd ${.CURDIR}/src && \
fe70af21 74 git remote add origin git://${GITHOST}/dragonfly.git
4922fbd1
MD
75 cd ${.CURDIR}/src && git fetch origin
76 cd ${.CURDIR}/src && git branch master origin/master
3ab6e27a
MD
77
78src-create: src-create-repo
4922fbd1
MD
79 cd ${.CURDIR}/src && git checkout master
80 cd ${.CURDIR}/src && git pull
f03b7956 81
fff08b59 82src-create-shallow: src-check
03ac22da 83 @echo "If problems occur you may have to rm -rf src and try again."
4060abb3 84 @echo
fff08b59 85 @mkdir -p ${.CURDIR}/src
03ac22da
MD
86 cd ${.CURDIR}/src && git init
87 cd ${.CURDIR}/src && \
bf00df77 88 git remote add origin git://${GITHOST}/dragonfly.git
03ac22da
MD
89 cd ${.CURDIR}/src && git fetch --depth=1 origin
90 cd ${.CURDIR}/src && git branch master origin/master
91 cd ${.CURDIR}/src && git checkout master
92 cd ${.CURDIR}/src && git pull
93
fff08b59 94src-checkout: src-check-hasdir
4922fbd1 95 cd ${.CURDIR}/src && git checkout master
e2dbfa0b 96
fff08b59 97src-update: src-check-hasdir
4922fbd1 98 cd ${.CURDIR}/src && git pull
e2dbfa0b 99
809ae383 100release-sys-extract:
9effbeff 101 cd ${.CURDIR} && tar xvpjf src-sys.tar.bz2
809ae383 102
fff08b59
AHJ
103dports-check: git-check
104 @/bin/test ! -d ${.CURDIR}/dports/.git || \
105 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false)
106
f0ef1af5
PAT
107dports-download-check:
108 @/bin/test ! -d ${.CURDIR}/dports || \
109 (echo "Error: ${.CURDIR}/dports already exists"; /usr/bin/false)
5c0c71f9
PAT
110 @/bin/test ! -d ${.CURDIR}/DragonFlyBSD-DPorts-* || \
111 (echo "Error: ${.CURDIR}/DragonFlyBSD-DPorts-* already exists"; /usr/bin/false)
f0ef1af5 112
fff08b59
AHJ
113dports-check-hasdir: git-check
114 @/bin/test -d ${.CURDIR}/dports || \
115 (echo "Error: ${.CURDIR}/dports does not exist"; /usr/bin/false)
116
117dports-update: dports-check-hasdir
4060abb3 118 cd ${.CURDIR}/dports && git pull
4060abb3 119
fff08b59 120dports-create: dports-check
4060abb3
JM
121 @echo "If problems occur you may have to rm -rf dports and try again."
122 @echo
3d88cbf2 123 git clone git://${GITHOST_DPORTS}/dports.git ${.CURDIR}/dports
4060abb3
JM
124.if exists(${.CURDIR}/pkg)
125 @echo ${WSTARS}
126 @echo ${WARNPS}
127 @echo ${WSTARS}
128.endif
4060abb3 129
fff08b59 130dports-create-shallow: dports-check
4060abb3
JM
131 @echo "If problems occur you may have to rm -rf dports and try again."
132 @echo
3d88cbf2 133 git clone --depth=1 git://${GITHOST_DPORTS}/dports.git \
4060abb3
JM
134 ${.CURDIR}/dports
135.if exists(${.CURDIR}/pkg)
136 @echo ${WSTARS}
137 @echo ${WARNPS}
138 @echo ${WSTARS}
139.endif
4060abb3 140
f0ef1af5 141dports-download: dports-download-check
4060abb3
JM
142 rm -f ${DPTBALL}
143 fetch -o ${DPTBALL} ${DPDLURL}
144 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 145 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
146 rm -f ${DPTBALL}
147.if exists(${.CURDIR}/pkg)
148 @echo ${WSTARS}
149 @echo ${WARNPS}
150 @echo ${WSTARS}
151.endif
4060abb3 152
fff08b59
AHJ
153dports-replace: dports-check-hasdir
154.if exists(${.CURDIR}/dports/.git)
4060abb3 155 @echo "Error: this is git repository currently."
da32363c 156 @echo "Remove ${.CURDIR}/dports and execute \"make dports-download\" if you want"
4060abb3 157 @echo "to convert to a non-git version."
fff08b59 158 @/usr/bin/false
4060abb3
JM
159.else
160 rm -f ${DPTBALL}
161 fetch -o ${DPTBALL} ${DPDLURL}
162 rm -rf ${.CURDIR}/dports
163 tar -xf ${DPTBALL} -C ${.CURDIR}
898339da 164 mv /usr/DragonFlyBSD-DPorts-* ${.CURDIR}/dports
4060abb3
JM
165 rm -f ${DPTBALL}
166.endif
3271cef5 167
0c95bff9
MD
168# NOTE: In force mode we also have to remove any old pkg.conf
169# which might interfere with the newer pkg bootstrap.
170#
f201b797 171pkg-bootstrap-force:
0c95bff9 172 @rm -f /usr/local/etc/pkg.conf
f201b797
MD
173 @fetch -o ${PKGBALL} ${PKGBOOT}
174 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
175 @rm -f ${PKGBALL}
daa5ccc1 176.if defined(ABIVERS)
f201b797 177 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
daa5ccc1
MD
178.else
179 ${.CURDIR}/local/sbin/pkg-static install -y -f pkg
180.endif
f201b797 181
3271cef5
JM
182pkg-bootstrap:
183.if exists(${.CURDIR}/local/sbin/pkg)
184 @echo ${ERRPKG}
fff08b59 185 @/usr/bin/false
3271cef5
JM
186.elif exists(${.CURDIR}/local/etc/pkg.conf)
187 @echo "Error: ${.CURDIR}/local/etc/pkg.conf will be ovewritten"
188 @echo "Please move this file and rerun 'make pkg-bootstrap'"
fff08b59 189 @/usr/bin/false
3271cef5
JM
190.else
191 @fetch -o ${PKGBALL} ${PKGBOOT}
192 @tar -xJf ${PKGBALL} -C ${.CURDIR}/local
193 @rm -f ${PKGBALL}
daa5ccc1 194.if defined(ABIVERS)
f201b797 195 ABI=${ABIVERS} ${.CURDIR}/local/sbin/pkg-static install -y pkg
daa5ccc1
MD
196.else
197 ${.CURDIR}/local/sbin/pkg-static install -y pkg
198.endif
3271cef5 199.endif