summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/Makefile.bsd-wrapper
blob: 69b6d21bfd1683a4f459e4e8fc8147cc3559c36a (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# $OpenBSD: Makefile.bsd-wrapper,v 1.75 2007/11/26 11:12:29 espie Exp $
#
# Build wrapper for Perl 5.8.6
#

# For ``NOMAN'' and ``USE_GCC3''
.include <bsd.own.mk>

# There is no point in building a profiled libperl that is never used.
NOPROFILE=

TARGET_MACHINE_ARCH?=	$(MACHINE_ARCH)
# To build a threaded perl, uncomment this.  Not stable on all platforms...
#THREADED_PERL=true

# Perl builds with -fno-strict-aliasing, we want libperl to do the same
CFLAGS+= -fno-strict-aliasing
.if ${USE_GCC3:L} == "yes"
CFLAGS+= -fno-delete-null-pointer-checks
.endif

# Arguments passed to Configure...
CONFIGURE_ARGS= -dsE -Dopenbsd_distribution=defined
.if defined(THREADED_PERL) && ($(THREADED_PERL) == true)
CONFIGURE_ARGS+= -Dusethreads
CFLAGS+= -pthread
.endif

# Our lndir is hacked; specify a full path to avoid potential conflicts
# with the one installed with X11.
LNDIR=		/usr/bin/lndir

H2PH=		/usr/bin/h2ph

LIB=	perl

SRCS=	perl.c gv.c toke.c perly.c op.c pad.c regcomp.c dump.c util.c mg.c \
	reentr.c hv.c av.c run.c pp_hot.c sv.c pp.c scope.c pp_ctl.c pp_sys.c \
	doop.c doio.c regexec.c utf8.c taint.c deb.c universal.c xsutils.c \
	globals.c perlio.c perlapi.c numeric.c locale.c pp_pack.c pp_sort.c    

CPPFLAGS+= -DPERL_CORE -DPERL_RANDOM_DEVICE=\"/dev/arandom\" -I.

.if defined (INSTALL_STRIP) && ${INSTALL_STRIP} == "-s"
STRIPFLAGS='-s'
.endif

GEN_AFTER= 	config.h cflags makeaperl makedepend makedir \
		myconfig writemain Makefile Policy.sh pod/Makefile \
		x2p/Makefile x2p/cflags

GENERATED=	config.sh ${GEN_AFTER}

${GEN_AFTER}: config.sh

CLEANFILES=	config.sh Policy.sh ${MANALL} ${PSALL} ${MANSRCALL} stamp-mansrc.build

.if !exists(${.OBJDIR}/config.over)
${.OBJDIR}/config.over: ${.CURDIR}/config.over
	${LNDIR} -s -e obj -e obj.${MACHINE_ARCH} -e Makefile.bsd-wrapper -e Makefile.bsd-wrapper1 ${.CURDIR}
.endif

all:	perl.build man.build


man.build: perl.build
	cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 $@

beforedepend:	config.sh config.h Makefile makedepend x2p/Makefile writemain
	cd ${.OBJDIR} && exec ${MAKE} depend

perl.build:	perl.lib
	cd ${.OBJDIR} && exec ${MAKE}

config.sh:	${.OBJDIR}/config.over
	cd ${.OBJDIR} && PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
	    exec /bin/sh Configure ${CONFIGURE_ARGS}

Makefile cflags makeaperl makedepend makedir myconfig writemain:	
	cd ${.OBJDIR} && exec /bin/sh $@.SH

Policy.sh:
	cd ${.OBJDIR} && exec /bin/sh Policy_sh.SH

config.h: 
	cd ${.OBJDIR} && exec /bin/sh config_h.SH

pod/Makefile:
	cd ${.OBJDIR}/pod && exec /bin/sh Makefile.SH

x2p/Makefile:
	cd ${.OBJDIR}/x2p && exec /bin/sh Makefile.SH

x2p/cflags:
	cd ${.OBJDIR}/x2p && exec /bin/sh cflags.SH

# Never try to regenerate perly.c or perly.h
perly.c perly.h: perly.y
	-@true

install: install.lib install.perl maninstall
	-mkdir -p ${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd
	(cd ${DESTDIR}/usr/include; ${H2PH} \
		-d ${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd \
		`find . -name '*.h'`; \
		pax -rw `find . -type l \! -name '*.h' | sed 's/^..//'` \
		${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd)
	-chmod -R a+rX ${DESTDIR}/usr/libdata/perl5

install.perl:
	cd ${.OBJDIR}; INSTALL=${INSTALL} INSTALL_COPY=${INSTALL_COPY} \
	 STRIPFLAGS=${STRIPFLAGS} INSTALLFLAGS=-o NOLIBINSTALL=1 \
	 LD_LIBRARY_PATH=${.OBJDIR} exec ./perl installperl --destdir=${DESTDIR} -o STRIPFLAGS=${STRIPFLAGS}

test:
	-@if [ -e Makefile ]; then ${MAKE} test; fi

clean:
	-@if [ -e Makefile ]; then ${MAKE} realclean; fi

cleandir:
	-@if [ ${.CURDIR} != ${.OBJDIR} ]; then \
	    rm -rf *; \
	else \
	    test -e Makefile && ${MAKE} distclean; \
	    rm -f ${CLEANFILES}; \
	fi
	@cd ${.CURDIR} && ${MAKE} -f Makefile.bsd-wrapper1 cleandir

maninstall:
.ifdef NOMAN
	@echo NOMAN is set
.else
	@cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 maninstall
.endif

.include <bsd.lib.mk>

# These have to come after the inclusion of <bsd.lib.mk>

# Need -fPIC, not -fpic on sparc
.if ($(TARGET_MACHINE_ARCH) == sparc)
PICFLAG=-fPIC
.endif

perl.lib:	${GENERATED} ${_LIBS}

install.lib:
	${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
	    ${DESTDIR}${LIBDIR}
.if (${INSTALL_COPY} != "-p")
	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(NOPROFILE)
	${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
.if (${INSTALL_COPY} != "-p")
	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(NOPIC) && (${MACHINE_ARCH} != "mips64") 
	${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
.if (${INSTALL_COPY} != "-p")
	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(NOPIC) && defined(major) && defined(minor)
	${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
	    lib${LIB}.so.${major}.${minor} ${DESTDIR}${LIBDIR}
.endif
.PHONY: perl.lib install.lib perl.build install.perl man.build mansrc.build