Plasma GitLab Archive
Projects Blog Knowledge

TOP_DIR=../..

include $(TOP_DIR)/Makefile.conf

PKGNAME = netcgi2-apache
# Keep the name in sync with the one on handler.c :
BUILD_EXTRA = mod_netcgi_apache.so

INCLUDES += $(INC_NETSTRING) $(INC_NETSYS) $(INC_NETCGI2)
REQUIRES += findlib

OBJECTS = netcgi_apache.cmo netcgi_modtpl.cmo
DOBJECTS = netcgi_apache.mli netcgi_modtpl.mli

ALL_EXTRA = mod_netcgi_apache.so
INSTALL_EXTRA = mod_netcgi_apache.so 500netcgi_apache.info

OCAMLC_OPTIONS += $(STRING_OPTS)
OCAMLOPT_OPTIONS += $(STRING_OPTS)

PP_OPTIONS = -pp "$(CPPO) $(PP_BYTES) $(PP_DEPRECATED)"

DOC_IGNORABLE = true

include $(TOP_DIR)/Makefile.rules

ifeq ($(APACHE_MAJOR),2)
APACHE_LDFLAGS_SHLIB += -lapr-1 -laprutil-1
endif

# mod_netcgi_apache.so: apache.lo handler.lo wrappers.lo netcgi_apache_mod.cmo
# 	$(OCAMLC) -verbose -custom -linkall -o $@ \
# 	  -cc "$(APXS) -c $(filter %.lo,$^)" \
# 	  dynlink.cma unix.cma $(filter-out %.lo,$^) \
# 	  -cclib '$(APACHE_CFLAGS) $(APACHE_LDFLAGS_SHLIB) $(APACHE_OCAMLLIBS)'
# $(patsubst %.o,.libs/%.o,$^) \

# %.o: %.c
# 	$(APACHE_CC) $(APACHE_CFLAGS) -I $(APACHE_OCAMLLIBDIR) -c $<

# -Wl,-bI:$(APACHE_LIBDIR)/httpd.exp
# mod_netcgi_apache.so: netcgi_apache_mod.cmo apache.o handler.o wrappers.o
# 	$(OCAMLC) -o $@ -verbose -linkall -custom \
# 	  -ccopt -Wl,--warn-unresolved-symbols \
# 	  dynlink.cma unix.cma $(patsubst %.o, ./.libs/%.o, $^) \
# 	  -cclib "$(APACHE_CFLAGS) $(APACHE_LDFLAGS_SHLIB) $(APACHE_OCAMLLIBS)"

MOD_OBJECTS := wrappers.o handler.o apache.o netcgi_apache_mod.o

# must be after the `include' for APACHE_MAJOR to be defined
ifeq ($(APACHE_MAJOR),2)
MOD_OBJECTS := $(patsubst %.o,%.lo,$(MOD_OBJECTS))
else
MOD_OBJECTS := $(MOD_OBJECTS)
endif

### Embed Caml code into the C code.
### Requires `caml_startup' instead of `caml_main' in handler.c
### Only works with OCaml >= 3.11 on plafforms where PIC differs from non-PIC
### See http://caml.inria.fr/mantis/view.php?id=3866
mod_netcgi_apache.so: $(MOD_OBJECTS)
	$(APXS) -c -o $@ $^ -L$(APACHE_OCAMLLIBDIR) -Wl,-R,$(APACHE_OCAMLLIBDIR) $(APACHE_OCAMLLIBS)
	test -f .libs/$@ && cp .libs/$@ .

netcgi_apache_mod.lo: netcgi_apache_mod.o
	echo "$@ generated by the rule for $^"
netcgi_apache_mod.o: netcgi_apache_mod.ml
	$(OCAMLC) -verbose -output-obj -linkall -o $@ \
	  -cc "./drive-apxs $(APXS)" \
	  -package "dynlink bytes unix findlib" -linkpkg $^

%.o: %.c
	$(APXS) -I$(APACHE_OCAMLLIBDIR) -c $<
%.lo: %.c
	$(APXS) -I$(APACHE_OCAMLLIBDIR) -c $<

include depend

This web site is published by Informatikbüro Gerd Stolpmann
Powered by Caml