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