1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
# Inclusion of Makefile.conf may fail when cleaning up:
-include $(TOP_DIR)/Makefile.conf
# Makefile.conf: written by "configure".
# How to invoke compilers and tools:
# (May be moved to Makefile.conf if necessary)
OCAMLC = $(OCAMLFIND) ocamlc -g $(OCAMLC_OPTIONS) $(INCLUDES) -package "$(REQUIRES)" $(PP_OPTIONS)
OCAMLOPT = $(OCAMLFIND) ocamlopt -inline 10 $(OCAMLOPT_OPTIONS) $(INCLUDES) -package "$(REQUIRES)" $(PP_OPTIONS)
OCAMLDEP = $(OCAMLFIND) ocamldep $(OCAMLDEP_OPTIONS) $(PP_OPTIONS)
OCAMLFIND = ocamlfind
OCAMLYACC = ocamlyacc
OCAMLLEX = ocamllex
CAMLP4 = camlp4
OCAMLMKLIB = ocamlmklib
OCAMLDOC = $(OCAMLFIND) ocamldoc
TOOLS_DIR = $(TOP_DIR)/tools
COLLECT_FILES = $(TOOLS_DIR)/collect_files
# To be overridden by the command line:
INC_NETSYS = -I $(TOP_DIR)/src/netsys
INC_NETSTRING = -I $(TOP_DIR)/src/netstring
INC_EQUEUE = -I $(TOP_DIR)/src/equeue
INC_EQUEUE_SSL = -I $(TOP_DIR)/src/equeue-ssl
INC_NETCGI1 = -I $(TOP_DIR)/src/netcgi1
INC_NETCGI2 = -I $(TOP_DIR)/src/netcgi2
INC_NETCGI2_APACHE = -I $(TOP_DIR)/src/netcgi2-apache
INC_NETPLEX = -I $(TOP_DIR)/src/netplex
INC_RPC = -I $(TOP_DIR)/src/rpc
INC_SHELL = -I $(TOP_DIR)/src/shell
# Select either "cgi" or "netcgi" as default CGI implementation (this
# is normally set in Makefile.config):
INC_CGI_OR_NETCGI ?= $(INC_CGI)
# Standard definitions and rules
XOBJECTS = $(OBJECTS:.cmo=.cmx)
ARCHIVE ?= $(PKGNAME)
.PHONY: all opt all-mt-vm opt-mt-vm all-mt-posix opt-mt-posix
ARCHIVE_CMA ?= $(ARCHIVE).cma
ARCHIVE_CMXA ?= $(ARCHIVE).cmxa
all: $(ARCHIVE_CMA) $(ALL_EXTRA) all-mt-$(MT_TYPE)
opt: $(ARCHIVE_CMXA) $(OPT_EXTRA) opt-mt-$(MT_TYPE)
all-mt-vm: $(ALLMT_EXTRA)
all-mt-posix: $(ALLMT_EXTRA)
opt-mt-vm:
opt-mt-posix: $(OPTMT_EXTRA)
$(ARCHIVE).cma: $(OBJECTS) $(COBJECTS)
if [ "X$(COBJECTS)" = "X" ]; then \
$(OCAMLC) -a -o $(ARCHIVE).cma $(OBJECTS); \
else \
$(OCAMLMKLIB) -o $(ARCHIVE) $(OBJECTS) $(COBJECTS) $(LINK_OPTIONS); \
fi
$(ARCHIVE).cmxa: $(XOBJECTS) $(COBJECTS)
if [ "X$(COBJECTS)" = "X" ]; then \
$(OCAMLOPT) -a -o $(ARCHIVE).cmxa $(XOBJECTS); \
else \
$(OCAMLMKLIB) -o $(ARCHIVE) $(XOBJECTS) $(COBJECTS) $(LINK_OPTIONS); \
fi
# Files to remove everywhere by "make clean":
CLEAN_LIST = *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa dll* packlist-* \
ocamldoc.dump META depend $(PACKLIST) $(GENERATE)
# Generic build rules:
.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly .c .o
.ml.cmx:
$(OCAMLOPT) -c $(OCAMLOPT_OPTIONS_FOR_$<) $<
.ml.cmo:
$(OCAMLC) -c $(OCAMLC_OPTIONS_FOR_$<) $<
.mli.cmi:
$(OCAMLC) -c $(OCAMLC_OPTIONS_FOR_$<) $<
.mll.ml:
$(OCAMLLEX) $<
.mly.ml:
$(OCAMLYACC) $<
.c.o:
$(OCAMLC) -c -ccopt -O $(CC_OPTIONS) $(CC_OPTIONS_FOR_$<) $<
# We add $(OBJECTS) to the antecedents of ocamldoc.dump to ensure that
# the files are compiled. ocamldoc needs the .cmi files, and this is
# the simplest way of ensuring that.
ocamldoc.dump: $(DOBJECTS) $(OBJECTS)
$(OCAMLDOC) -dump ocamldoc.dump -stars $(INCLUDES) -package "$(REQUIRES)" $(PP_OPTIONS) $(OCAMLDOC_OPTIONS) $(DOBJECTS) || { rm -f ocamldoc.dump; exit 1; }
# Install rules:
.PHONY: install
install:
@$(MAKE) -f Makefile.pre realinstall
.PHONY: realinstall
realinstall: install-$(INSTMETHOD) $(INSTOTHER) $(PACKLIST)
.PHONY: uninstall
uninstall:
@$(MAKE) -f Makefile.pre realuninstall
.PHONY: realuninstall
realuninstall: $(UNINSTOTHER) uninstall-$(INSTMETHOD)
.PHONY: install-findlib
install-findlib: META
files=`$(COLLECT_FILES) *.mli *.cmi *.cma *.cmxa *.a dll* META $(INSTALL_EXTRA)` && \
$(OCAMLFIND) install $(PKGNAME) $$files
.PHONY: uninstall-findlib
uninstall-findlib:
$(OCAMLFIND) remove $(PKGNAME)
if [ -n "$(PACKLIST)" ]; then \
if packlist=`ocamlfind query $(PKGNAME)`/$(PACKLIST); then \
if [ -f "$$packlist" ]; then \
files=`cat $$packlist` && \
rm -f $$files; \
echo "$$files" | xargs echo "Removed "; \
fi; \
fi; \
fi
META: META.in
sed -e 's/@VERSION@/$(VERSION)/' \
-e 's/@AUTHDHREQS@/$(AUTHDHREQS)/' \
-e 's/@PREFERRED_CGI_PKG@/$(PREFERRED_CGI_PKG)/' \
META.in >META
#----------------------------------------------------------------------
# general rules:
DEP_FILES ?= $(wildcard *.ml) $(wildcard *.mli)
depend: $(DEP_FILES)
$(OCAMLDEP) *.ml *.mli >$@ || { rm -f $@; exit 1; }
.PHONY: clean
clean::
rm -f $(CLEAN_LIST)
.PHONY: clean-doc
clean-doc::
rm -f ocamldoc.dump
.PHONY: distclean
distclean::
rm -f $(CLEAN_LIST) META
rm -f *~ depend
.PHONY: generate
generate:
@$(MAKE) -f Makefile.pre realgenerate
.PHONY: realgenerate
realgenerate:: $(GENERATE)
|