44 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # build recompiles and links all files (no incemental builds)
 | |
| build:
 | |
| 	# fromStdlib manages things that need to be exposed from the standard library
 | |
| 	ocamlopt -i fromStdlib.ml > fromStdlib.mli
 | |
| 	ocamlopt -S -O3 -c fromStdlib.mli fromStdlib.ml
 | |
| 
 | |
| 	# types for other modules separated to easily expose without module reference in projects	
 | |
| 	ocamlopt -S -O3 -nopervasives -c types.mli types.ml
 | |
| 
 | |
| 	# the following files make up the core custom standard library code
 | |
| 	ocamlopt -S -O3 -nopervasives -c functions.mli functions.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c stack.mli stack.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c list.mli list.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c map.mli map.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c queue.mli queue.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c set.mli set.ml
 | |
| 	ocamlopt -S -O3 -nopervasives -c tree.mli tree.ml
 | |
| 
 | |
| 	# main is the main file to run code in
 | |
| 	ocamlopt -i main.ml > main.mli
 | |
| 	ocamlopt -S -O3 -nopervasives -c main.mli main.ml
 | |
| 
 | |
| 	# after all files are individually compiled with -nopervasives, this is compiled with it so that fromStdlib has the necessary linking
 | |
| 	ocamlopt -S -O3 fromStdlib.cmx types.cmx functions.cmx stack.cmx list.cmx map.cmx queue.cmx set.cmx tree.cmx main.cmx -o program
 | |
| 
 | |
| # clean removes all except source files. autogenerated mli files are also removed.
 | |
| clean:
 | |
| 	rm -f *.o *.a *.s *.cmi *.cmx *.cmxa *.cmo *.cma fromStdlib.mli main.mli program
 | |
| 
 | |
| # mostlyclean removes all except source files and the final executable. autogenerated mli files are also removed.
 | |
| mostlyclean:
 | |
| 	rm -f *.o *.a *.s *.cmi *.cmx *.cmxa *.cmo *.cma fromStdlib.mli main.mli
 | |
| 
 | |
| # install builds, mostlycleans and runs
 | |
| install:
 | |
| 	make build
 | |
| 	make mostlyclean
 | |
| 	./program
 | |
| 
 | |
| # just runs the executable if it has been produced by make build
 | |
| make run:
 | |
| 	./program
 | |
| 
 |