File indexing completed on 2024-04-21 03:41:40

0001 
0002 OCAMLC = ocamlc -g
0003 OCAMLMLI = ocamlc
0004 OCAMLOPT = ocamlopt
0005 OCAMLDEP = ocamldep
0006 INCLUDES = -I +facile
0007 OPTOPT = 
0008 OCAMLLIB := $(shell echo `ocamlc -where`)
0009 FACILELIB = $(OCAMLLIB)/facile
0010 
0011 
0012 # link to these libraries
0013 LIBADD_CMX = $(OCAMLLIB)/facile/facile.cmxa #$(OCAMLLIB)/str.cmxa
0014 LIBADD_CMO = $(OCAMLLIB)/facile/facile.cma #$(OCAMLLIB)/str.cma
0015 
0016 # our sources
0017 SOURCES_CHEM = chemset.ml parser.ml lexer.ml datastruct.ml chem.ml  calc.ml
0018 SOURCES_WRAP = modwrap.c
0019 
0020 # the targets
0021 CHEM_CMO = $(SOURCES_CHEM:.ml=.cmo)
0022 CHEM_CMX = $(SOURCES_CHEM:.ml=.cmx)
0023 CHEM_O = $(SOURCES_WRAP:.c=.o)
0024 
0025 # default target : the object files for eqchem
0026 all : solver.o
0027 
0028 # shows how to build a program that embeds the solver
0029 # in compiled ocaml, bytecode ocaml and compiled program using compiled caml code
0030 test: atestprog.opt btestprog.out testcprog
0031 
0032 atestprog.opt: $(CHEM_CMX) main.cmx
0033         $(OCAMLOPT) -o $@ $(LIBADD_CMX) $(CHEM_CMX) main.cmx
0034 
0035 btestprog.out: $(CHEM_CMO) main.cmo
0036         $(OCAMLMLI) -o $@ $(LIBADD_CMO) $(CHEM_CMO) main.cmo
0037 
0038 solver.o: $(CHEM_CMX) $(CHEM_O)
0039         $(OCAMLOPT) -output-obj -o solver.o $(LIBADD_CMX) $(CHEM_CMX)
0040         cp -f solver.o modwrap.o ../
0041 
0042 testcprog: $(CHEM_CMX) $(CHEM_O)
0043         $(OCAMLOPT) -output-obj -o solver.o $(LIBADD_CMX) $(CHEM_CMX) modwrap.o
0044         gcc -c -o main.o main.c -L $(OCAMLLIB)
0045         gcc -o $@ main.o solver.o -L $(OCAMLLIB) \
0046           -L $(OCAMLLIB)/facile -lasmrun -lstr -lnums -lm -ldl modwrap.o
0047 
0048 .SUFFIXES:
0049 .SUFFIXES: .ml .mli .mly .mll .cmi .cmo .cmx .p.cmx .c
0050 
0051 .ml.cmo :
0052         $(OCAMLC) $(INCLUDES) $(INCLUDES) -c $<
0053 
0054 .mli.cmi :
0055         $(OCAMLMLI) $(INCLUDES) -c $<
0056 
0057 .ml.cmx :
0058         $(OCAMLOPT) $(OPTOPT) $(INCLUDES) -c $<
0059 
0060 .mly.ml :
0061         ocamlyacc $<
0062 
0063 .mll.ml :
0064         ocamllex $<
0065 
0066 %.o : %.c
0067         $(OCAMLOPT) $(OPTOPT) $(INCLUDES) -c $<
0068 
0069 clean:
0070         \rm -f *.cm[iox] *.o *~ .depend *testprog.* testcprog
0071 
0072 cleanall : clean
0073         \rm -f *.cmxa *.a *.cma
0074 
0075 distclean : clean
0076 
0077 interfaces:
0078         ocamlc -i datastruct.ml > datastruct.mli
0079         ocamlc -I +facile -i chem.ml > chem.mli
0080         ocamlc -I +facile -i calc.ml > calc.mli
0081 
0082 maintainer-clean : clean
0083 
0084 uninstall : clean
0085 
0086 install : 
0087         echo "done"
0088 
0089 .depend: parser.ml lexer.ml
0090         $(OCAMLDEP) $(INCLUDES) *.mli *.ml > $@
0091 
0092 include .depend