Fix building external extensions.

This commit is contained in:
Sascha Schumann 2000-05-02 20:10:46 +00:00
parent 733d94909f
commit 5989ae5dc1
4 changed files with 47 additions and 67 deletions

View File

@ -33,13 +33,13 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@
mkinstalldirs = $(top_srcdir)/build/shtool mkdir -f -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644
SHARED_COMPILE = $(SHARED_LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< && touch $@
DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I$(top_builddir)
moduledir = $(libdir)/php/modules
moduledir = $(EXTENSION_DIR)
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s .y .l
.SUFFIXES: .slo .c .lo .o .s .y .l
.c.o:
$(COMPILE) -c $<
@ -47,17 +47,14 @@ moduledir = $(libdir)/php/modules
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
.c.lo:
$(PHP_COMPILE)
.s.lo:
$(PHP_COMPILE)
.S.lo:
$(PHP_COMPILE)
.c.slo:
$(SHARED_COMPILE)
.y.c:
$(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
@ -68,44 +65,37 @@ moduledir = $(libdir)/php/modules
.l.c:
$(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
#################################
# Simplified Makefile
install_targets = install-modules
all: shared
install: shared install-modules
#################################
#all: all-recursive
all: all-recursive
install: install-recursive
distclean-recursive depend-recursive clean-recursive all-recursive install-recursive:
@otarget=`echo $@|sed s/-recursive//`; \
if test '$(NO_RECURSION)' != "$$otarget"; then \
list='$(SUBDIRS)'; for i in $$list; do \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
ok=yes; \
target="$$target-p"; \
fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
done; \
test "$otarget" = "all" && test -z '$(targets)' && ok=yes; \
test "$ok" = "yes" || $(MAKE) "$$otarget-p" || exit 1; \
fi;
list='$(SUBDIRS)'; for i in $$list; do \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
ok=yes; \
target="$$target-p"; \
fi; \
if test ! -f $$i/.deps; then touch $$i/.deps; fi; \
(cd $$i && $(MAKE) $$target) || exit 1; \
done; \
if test "$$otarget" = "all" && test -z '$(targets)'; then ok=yes; fi; \
if test "$$ok" != "yes"; then $(MAKE) "$$otarget-p" || exit 1; fi
all-p: $(targets)
install-p: $(targets) $(install_targets)
distclean-p depend-p clean-p:
depend: depend-recursive
test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) *.c > .deps
test "`echo *.c`" = '*.c' || perl $(top_srcdir)/build/mkdep.perl $(CPP) $(INCLUDES) $(EXTRA_INCLUDES) *.c > $(builddir)/.deps
clean: clean-recursive clean-x
clean-x:
rm -f $(targets) *.lo *.la *.o $(CLEANFILES)
rm -f $(targets) *.lo *.slo *.la *.o $(CLEANFILES)
rm -rf .libs
distclean: distclean-recursive clean-x
@ -119,7 +109,7 @@ install-modules:
rm -f modules/*.la && \
cp modules/* $(moduledir) || true
include $(srcdir)/.deps
include $(builddir)/.deps
.PHONY: all-recursive clean-recursive install-recursive \
$(install_targets) install all clean depend depend-recursive shared \

View File

@ -32,6 +32,7 @@ BUILD_FILES = \
build/rules_pear.mk \
build/dynlib.mk \
build/shtool \
dynlib.m4 \
acinclude.m4
install-build:
@ -52,27 +53,8 @@ install-build:
mv $(bindir)/php-config.tmp $(bindir)/php-config && \
cp $(srcdir)/phpextdist $(bindir)/phpextdist
SRC_HEADERS = \
php.h \
php_regex.h \
php3_compat.h \
safe_mode.h \
fopen-wrappers.h \
php_version.h \
php_globals.h \
php_reentrancy.h \
php_ini.h \
SAPI.h
BUILD_HEADERS = \
php_config.h \
Zend/zend_config.h \
build-defs.h
STANDARD_HEADERS = \
php_output.h
HEADER_DIRS = \
/ \
Zend \
TSRM \
ext/standard \
@ -84,9 +66,7 @@ install-headers:
done; \
$(mkinstalldirs) $$paths && \
echo "creating header file hierarchy" && \
(cd $(top_srcdir) && cp $(SRC_HEADERS) $(phpincludedir)) && \
(cd $(top_srcdir)/ext/standard && cp *.h $(phpincludedir)/ext/standard) && \
(cd $(top_srcdir) && cp regex/regex.h regex/regex_extra.h $(phpincludedir)/regex) && \
(cd $(top_srcdir) && cp TSRM/TSRM.h $(phpincludedir)/TSRM) && \
(cd $(top_srcdir)/Zend && cp *.h $(phpincludedir)/Zend) && \
(cd $(top_builddir) && cp $(BUILD_HEADERS) $(phpincludedir))
for i in $(HEADER_DIRS); do \
cd $(top_srcdir)/$$i && cp -p *.h $(phpincludedir)/$$i; \
cd $(top_builddir)/$$i && cp -p *.h $(phpincludedir)/$$i; \
done

View File

@ -37,13 +37,15 @@ enable_shared=yes
AC_PROG_LIBTOOL
SHLIBTOOL='$(LIBTOOL)'
SHARED_LIBTOOL='$(LIBTOOL)'
PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<'
phplibdir="`pwd`/modules"
test "$prefix" = "NONE" && prefix="/usr/local"
test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
EXTENSION_DIR="$prefix/lib/php/modules"
PHP_SUBST(prefix)
PHP_SUBST(exec_prefix)
PHP_SUBST(libdir)
@ -57,13 +59,14 @@ PHP_SUBST(CPP)
PHP_SUBST(CPPFLAGS)
PHP_SUBST(CXX)
PHP_SUBST(DEFS)
PHP_SUBST(EXTENSION_DIR)
PHP_SUBST(EXTRA_LDFLAGS)
PHP_SUBST(EXTRA_LIBS)
PHP_SUBST(INCLUDES)
PHP_SUBST(LEX)
PHP_SUBST(LEX_OUTPUT_ROOT)
PHP_SUBST(LFLAGS)
PHP_SUBST(SHLIBTOOL)
PHP_SUBST(SHARED_LIBTOOL)
PHP_SUBST(LIBTOOL)
PHP_SUBST(SHELL)
@ -71,6 +74,8 @@ PHP_FAST_OUTPUT(Makefile)
PHP_FAST_GENERATE
test -d modules || mkdir modules
AC_CONFIG_HEADER(php_config.h)
AC_OUTPUT()

View File

@ -1,24 +1,29 @@
#! /bin/sh
prefix='@PREFIX@'
phpdir="$prefix/lib/php/build"
builddir="`pwd`"
FILES_BUILD="dynlib.mk fastgen.sh library.mk ltlib.mk program.mk rules.mk rules_pear.mk shtool"
FILES="acinclude.m4 dynlib.m4"
if test ! -r config.m4; then
echo "Cannot find config.m4. "
echo "Make sure that you run $0 in the top level source directory of the module"
exit 1
fi
test -d build || mkdir build
for i in fastgen.sh library.mk ltlib.mk program.mk rules.mk rules_pear.mk shtool; do
cp $phpdir/$i build
done
(cd $phpdir && cp $FILES_BUILD $builddir/build)
(cd $phpdir && cp $FILES $builddir)
mv build/rules_pear.mk build/rules.mk
cp $phpdir/acinclude.m4 .
sed \
-e "s#@prefix@#$prefix#" \
< $phpdir/pear.m4 > configure.in
touch .deps install-sh mkinstalldirs missing
touch install-sh mkinstalldirs missing
aclocal
autoconf