apMakefile.tmpl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ##
  2. ## Apache 1.3 Makefile template for PHP 4.0 Module
  3. ## [src/modules/php5/Makefile.tmpl]
  4. ##
  5. # the parametrized target
  6. LIB=libphp5.$(LIBEXT)
  7. # objects for building the static library
  8. OBJS=mod_php5.o
  9. OBJS_LIB=libmodphp5.a
  10. # objects for building the shared object library
  11. SHLIB_OBJS=mod_php5.so-o
  12. SHLIB_OBJS_LIB=libmodphp5.a
  13. # the general targets
  14. all: lib
  15. lib: $(LIB)
  16. # build the static library by merging the object files
  17. libphp5.a: $(OBJS) $(OBJS_LIB)
  18. cp $(OBJS_LIB) $@
  19. ar r $@ $(OBJS)
  20. $(RANLIB) $@
  21. # ugly hack to support older Apache-1.3 betas that don't set $LIBEXT
  22. libphp5.: $(OBJS) $(OBJS_LIB)
  23. cp $(OBJS_LIB) $@
  24. ar r $@ $(OBJS)
  25. $(RANLIB) $@
  26. cp libphp5. libphp5.a
  27. # build the shared object library by linking the object files
  28. libphp5.so: $(SHLIB_OBJS) $(SHLIB_OBJS_LIB)
  29. rm -f $@
  30. $(LD_SHLIB) $(LDFLAGS_SHLIB) -o $@ $(SHLIB_OBJS) $(SHLIB_OBJS_LIB) $(LIBS) $(PHP_LIBS)
  31. # 1. extension .o for shared objects cannot be used here because
  32. # first these files aren't still shared objects and second we
  33. # have to use a different name to trigger the different
  34. # implicit Make rule
  35. # 2. extension -so.o (as used elsewhere) cannot be used because
  36. # the suffix feature of Make really wants just .x, so we use
  37. # extension .so-o
  38. .SUFFIXES: .o .so-o
  39. .c.o:
  40. $(CC) -c $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $<
  41. .c.so-o:
  42. $(CC) -c $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $(PHP_CFLAGS) $(CPPFLAGS) $(SPACER) $< && mv $*.o $*.so-o
  43. # cleanup
  44. clean:
  45. -rm -f $(OBJS) $(SHLIB_OBJS) $(LIB)
  46. # We really don't expect end users to use this rule. It works only with
  47. # gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after
  48. # using it.
  49. depend:
  50. cp Makefile.tmpl Makefile.tmpl.bak \
  51. && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.tmpl > Makefile.new \
  52. && gcc -MM $(INCLUDES) $(CFLAGS) $(PHP_CFLAGS) $(CPPFLAGS) *.c >> Makefile.new \
  53. && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' Makefile.new \
  54. > Makefile.tmpl \
  55. && rm Makefile.new
  56. #Dependencies
  57. $(OBJS): Makefile
  58. # DO NOT REMOVE
  59. mod_php5.o: mod_php5.c $(INCDIR)/httpd.h $(INCDIR)/conf.h \
  60. $(INCDIR)/buff.h \
  61. $(INCDIR)/http_config.h \
  62. $(INCDIR)/http_core.h $(INCDIR)/http_main.h \
  63. $(INCDIR)/http_protocol.h $(INCDIR)/http_request.h \
  64. $(INCDIR)/http_log.h $(INCDIR)/util_script.h mod_php5.h