1# $OpenBSD: Makefile.bsd-wrapper,v 1.103 2016/07/03 01:07:47 afresh1 Exp $ 2# 3# Build wrapper for Perl 5.20.1-RC2 4# 5 6# For ``NOMAN'' 7.include <bsd.own.mk> 8 9# There is no point in building a profiled libperl that is never used. 10NOPROFILE= 11 12TARGET_MACHINE_ARCH?= $(MACHINE_ARCH) 13 14# Perl builds with -fno-strict-aliasing, we want libperl to do the same 15CFLAGS+= -fno-strict-aliasing 16CFLAGS+= -fno-delete-null-pointer-checks 17 18CONFIGURE_ARGS= -dsE -Dopenbsd_distribution=defined -Dccflags='-DNO_LOCALE_NUMERIC -DNO_LOCALE_COLLATE' 19 20.if !exists(${.OBJDIR}/config.over) 21CONFIGURE_ARGS+= -Dmksymlinks 22.endif 23 24H2PH= /usr/bin/h2ph 25 26LIB= perl 27 28SRCS1= gv.c toke.c perly.c pad.c regcomp.c dump.c util.c mg.c reentr.c \ 29 mro.c keywords.c hv.c av.c run.c pp_hot.c sv.c pp.c scope.c pp_ctl.c \ 30 pp_sys.c doop.c doio.c regexec.c utf8.c taint.c deb.c universal.c \ 31 globals.c perlio.c perlapi.c numeric.c mathoms.c locale.c \ 32 pp_pack.c pp_sort.c caretx.c 33SRCS= ${SRCS1} op.c perl.c 34 35# We must not try to mkdep DynaLoader.c as it requires miniperl 36OBJS+= DynaLoader.o 37 38# For generating DynaLoader.c 39.if defined(NOPIC) 40DYNALOADER=ext/DynaLoader/dl_none.xs 41.else 42DYNALOADER=ext/DynaLoader/dl_dlopen.xs 43.endif 44 45# Arguments passed to Configure... 46 47CPPFLAGS+= -DPERL_CORE -DNO_LOCALE_NUMERIC -DNO_LOCALE_COLLATE -DBIG_TIME -I. 48 49.if defined (INSTALL_STRIP) && ${INSTALL_STRIP} == "-s" 50STRIPFLAGS='-s' 51.endif 52 53GEN_AFTER= bitcount.h config.h mg_data.h uudmap.h cflags makedepend \ 54 myconfig Makefile Policy.sh pod/Makefile \ 55 x2p/Makefile 56 57GENERATED= config.sh ${GEN_AFTER} 58 59${GEN_AFTER}: config.sh 60 61CLEANFILES= config.sh Policy.sh DynaLoader.c 62 63all: perl.build man.build 64 65man.build: perl.build 66 cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 mansrc.build 67 68beforedepend: config.sh config.h bitcount.h mg_data.h uudmap.h Makefile makedepend x2p/Makefile 69 cd ${.OBJDIR} && exec ${MAKE} depend 70 71perl.build: perl.lib DynaLoader.c 72 cd ${.OBJDIR} && exec ${MAKE} 73 74config.sh: ${.CURDIR}/config.over 75 cd ${.OBJDIR} && PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ 76 exec /bin/sh ${.CURDIR}/Configure ${CONFIGURE_ARGS} 77 78Makefile cflags makedepend makedir myconfig: 79 cd ${.OBJDIR} && exec /bin/sh $@.SH 80 81Policy.sh: 82 cd ${.OBJDIR} && exec /bin/sh Policy_sh.SH 83 84config.h: 85 cd ${.OBJDIR} && exec /bin/sh config_h.SH 86 87uudmap.h: bitcount.h 88mg_data.h: bitcount.h 89 90bitcount.h: generate_uudmap 91 ./generate_uudmap uudmap.h bitcount.h mg_data.h 92 93generate_uudmap: generate_uudmap.o 94 ${CC} ${CPPFLAGS} ${CFLAGS} -o generate_uudmap generate_uudmap.o 95 96pod/Makefile: 97 cd ${.OBJDIR}/pod && exec /bin/sh Makefile.SH 98 99x2p/Makefile: 100 cd ${.OBJDIR}/x2p && exec /bin/sh Makefile.SH 101 102# Never try to regenerate perly.c or perly.h 103perly.c perly.h: perly.y 104 -@true 105 106install: install.lib install.perl maninstall 107 -mkdir -p ${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd 108 (cd ${DESTDIR}/usr/include; ${H2PH} \ 109 -d ${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd \ 110 `find . -name '*.h'`; \ 111 pax -rw `find . -type l \! -name '*.h' | sed 's/^..//'` \ 112 ${DESTDIR}/usr/libdata/perl5/site_perl/${MACHINE_ARCH}-openbsd) 113 -chmod -R a+rX ${DESTDIR}/usr/libdata/perl5 114 115install.perl: 116 cd ${.OBJDIR}; INSTALL=${INSTALL} INSTALL_COPY=${INSTALL_COPY} \ 117 STRIPFLAGS=${STRIPFLAGS} INSTALLFLAGS=-o NOLIBINSTALL=1 \ 118 LD_LIBRARY_PATH=${.OBJDIR} exec ./perl installperl --destdir=${DESTDIR} -o ${STRIPFLAGS} 119 120test: 121 -@if [ -e Makefile ]; then ${MAKE} test; fi 122 123clean: 124 -@if [ -e Makefile ]; then ${MAKE} realclean; fi 125 126cleandir: 127 -@if [ ${.CURDIR} != ${.OBJDIR} ]; then \ 128 rm -rf *; \ 129 else \ 130 test -e Makefile && ${MAKE} distclean; \ 131 rm -f ${CLEANFILES}; \ 132 fi 133 @cd ${.CURDIR} && ${MAKE} -f Makefile.bsd-wrapper1 cleandir 134 135maninstall: 136.ifdef NOMAN 137 @echo NOMAN is set 138.else 139 @cd ${.CURDIR} && exec ${MAKE} -f Makefile.bsd-wrapper1 maninstall 140.endif 141 142.include <bsd.lib.mk> 143 144# These have to come after the inclusion of <bsd.lib.mk> 145 146# Need -fPIC, not -fpic on sparc 147.if ($(TARGET_MACHINE_ARCH) == sparc) 148PICFLAG=-fPIC 149.endif 150 151# Unaligned access on alpha with -ftree-ter 152# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59679 153# More details 154# https://rt.perl.org/Public/Bug/Display.html?id=120888 155.if ($(TARGET_MACHINE_ARCH) == alpha) 156CFLAGS+= -fno-tree-ter 157.endif 158 159# The DynaLoader extension is now compiled statically into libperl 160miniperl: ${GENERATED} ${SRCS1:S/.c/.o/g} opmini.o perlmini.o miniperlmain.o 161 ${CC} ${CPPFLAGS} ${CFLAGS} -o $@ ${SRCS1:S/.c/.o/g} opmini.o perlmini.o miniperlmain.o ${LDFLAGS} -lm 162 163opmini.c: op.c 164 rm -f opmini.c 165 cp op.c opmini.c 166 167opmini.o: opmini.c 168 ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -c $> -o $@ 169 170perlmini.o: perlmini.c 171 ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -c $> -o $@ 172 173lib/Config.pm: miniperl config.sh 174 cd ${.OBJDIR} && exec ${MAKE} preplibrary 175 176DynaLoader.c: miniperl ${DYNALOADER} lib/Config.pm 177 ./miniperl -Ilib -Idist/Cwd -Idist/Cwd/lib -Idist/ExtUtils-ParseXS/lib \ 178 -Icpan/Getopt-Long/lib -Idist/constant/lib -Iext/re \ 179 -mExtUtils::Typemaps dist/ExtUtils-ParseXS/lib/ExtUtils/xsubpp \ 180 -noprototypes -typemap ../../lib/ExtUtils/typemap ${DYNALOADER} | \ 181 sed -f ${.CURDIR}/DynaLoader.sed > $@; test -s $@ || rm -f $@ 182 183perl.lib: ${GENERATED} ${_LIBS} 184 185install.lib: 186 ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \ 187 ${DESTDIR}${LIBDIR} 188.if (${INSTALL_COPY} != "-p") 189 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a 190.endif 191 chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a 192.if !defined(NOPROFILE) 193 ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \ 194 lib${LIB}_p.a ${DESTDIR}${LIBDIR} 195.if (${INSTALL_COPY} != "-p") 196 ${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 197.endif 198 chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a 199.endif 200.if !defined(NOPIC) && defined(major) && defined(minor) 201 ${INSTALL} ${INSTALL_COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ 202 lib${LIB}.so.${major}.${minor} ${DESTDIR}${LIBDIR} 203.endif 204.PHONY: perl.lib install.lib perl.build install.perl man.build 205