File: bps.objdir.mk

package info (click to toggle)
bsdowl 2.2.2-1.3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,448 kB
  • sloc: sh: 828; makefile: 383; ml: 267; lisp: 54
file content (111 lines) | stat: -rw-r--r-- 2,551 bytes parent folder | download | duplicates (3)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
### bps.objdir.mk -- Utilisation de OBJDIR

# Author: Michael Grünewald
# Date: Sam 15 mar 2008 20:51:30 CET
# Cookie: SYNOPSIS TARGET VARIABLE EN DOCUMENTATION

# BSD Owl Scripts (https://bitbucket.org/michipili/bsdowl)
# This file is part of BSD Owl Scripts
#
# Copyright © 2005–2014 Michael Grünewald
#
# This file must be used under the terms of the CeCILL-B.
# This source file is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt


### SYNOPSIS

# .include "bps.objdir.mk"


### DESCRIPTION

# Le programme BSD Make dispose de certaines fonctionnalités
# permettant de produire le code objet dans un répertoire différent de
# celui contenant le code source. Ce module propose une interface
# simplifiée vers ces fonctionnalités.
#
# Note: Plus que tout autre, ce module de directives peut entraîner la
#   perte de données par son utilisation maladroite.

#
# Description des variables
#

# MAKE_OBJDIR
# MAKE_OBJDIRPREFIX
# USE_OBJDIR

### IMPLÉMENTATION

.if !target(__<bps.objdir.mk>__)
__<bps.objdir.mk>__:

#
# Contrôle de MAKEOBJDIRPREFIX et MAKEOBJDIR
#

# On vérifie que les variables MAKEOBJDIRPREFIX et MAKEOBJDIR n'ont
# pas été positionnées sur la ligne de commande ou dans le fichier de
# directives (cf. make(1), .OBJDIR).

_MAKE_OBJDIRPREFIX!= ${ENVTOOL} -i PATH=${PATH} ${MAKE} \
	${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} -f /dev/null -V MAKEOBJDIRPREFIX nothing

.if !empty(_MAKE_OBJDIRPREFIX)
.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
	(in make.conf(5)) or command-line variable.
.endif

_MAKE_OBJDIR!= ${ENVTOOL} -i PATH=${PATH} ${MAKE} \
       ${.MAKEFLAGS:MMAKEOBJDIR=*} -f /dev/null -V MAKEOBJDIR nothing

.if !empty(_MAKE_OBJDIR)
.error MAKEOBJDIR can only be set in environment, not as a global\
       (in bps.conf(5)) or command-line variable.
.endif



.undef _MAKE_OBJDIRPREFIX
.undef _MAKE_OBJDIR


#
# Initialisation
#

.if defined(MAKEOBJDIR)||defined(MAKEOBJDIRPREFIX)
USE_OBJDIR?= yes
.else
USE_OBJDIR?= no
.endif

#
# User targets
#

.if ${USE_OBJDIR} == yes
_MAKE_USERTARGET+= obj
_MAKE_ALLSUBTARGET+= obj

do-obj:
.if defined(MAKEOBJDIRPREFIX)
	${INSTALL_DIR} ${MAKEOBJDIRPREFIX}/${.CURDIR}
.elif defined(MAKEOBJDIR)
	${INSTALL_DIR} ${MAKEOBJDIR}
.endif

.if ${.OBJDIR} != ${.CURDIR}
distclean:
	@rm -Rf ${.OBJDIR}
.endif

.endif # USE_OBJDIR

.endif # !target(__<bps.objdir.mk>__)

### End of file `bps.objdir.mk'