Configuring and Managing MPE/iX Internet Services (July 2001)

Chapter 9 187
Apache for MPE/iX
Sample Module Code (mod_hw)
Modified APXS Makefile (mod_hw)
This Makefile is a modified version of the apxs auto-generated
Makefile. It shows how to call gcc for compiling and LinkEditor for
linking. The APXS variable was also changed to contain a fully
qualified path to apxs. Apxs is used for getting the correct defines and
includes. It is also used for installing the new module in the libexec/
directory.
Make sure to use tabs (instead of spaces) when adding callci and gcc
to the MakeFile.
shell/iX> cat Makefile
##
## Makefile -- Build procedure for sample hw Apache module
## Autogenerated via ``apxs -n hw -g''.
##
## 3/01 Modified Makefile to replace apxs by gcc and linkedit for compile
and ## link
# the used tools
APXS=/APACHE/PUB/bin/apxs
APACHECTL=/APACHE/PUB/bin/apachectl
# defines, includes and libraries
DEF=`$(APXS) -q CFLAGS`
INC=-I`$(APXS) -q INCLUDEDIR`
LIB=/lib/libm.a,/lib/libc.a
# the default target
all: mod_hw.so
# link the shared object file
mod_hw.so: mod_hw.o hw.o
callci "linkedit 'buildxl xl=./mod_hw.so;limit=5'"
callci "linkedit 'addxl from=./mod_hw.o,./hw.o;to=./mod_hw.so; \
rl=$(LIB);merge;share'"
# compile the object files
mod_hw.o: mod_hw.c
gcc -o mod_hw.o $(DEF) $(INC) -c mod_hw.c
hw.o: hw.c
gcc -o hw.o $(DEF) $(INC) -c hw.c
# install the shared object file into Apache
install: all
$(APXS) -i -a -n 'hw' mod_hw.so
# cleanup
clean:
-rm -f mod_hw.o mod_hw.so hw.o