Makefile 1.95 KB
Newer Older
gerd's avatar
gerd committed
1 2 3 4 5 6 7 8
# make all: 		make bytecode archive
# make install: 	install bytecode archive
# make uninstall: 	uninstall package
# make clean: 		remove intermediate files
# make distclean: 	remove any superflous files
# make release: 	cleanup, create archive, tag CVS module 
#			(for developers)

gerd's avatar
gerd committed
9 10 11

include Makefile.conf

gerd's avatar
gerd committed
12 13 14 15 16 17
#----------------------------------------------------------------------
# specific rules for this package:

OBJECTS  = xstrp4_here_types.cmo xstrp4_here_lexer.cmo xstrp4_here.cmo
ARCHIVE  = xstrp4.cma
NAME     = xstrp4
Gerd Stolpmann's avatar
Gerd Stolpmann committed
18
REQUIRES = bytes
gerd's avatar
gerd committed
19 20 21 22 23 24 25

all: $(ARCHIVE)

$(ARCHIVE): $(OBJECTS)
	$(OCAMLC) -a -o $(ARCHIVE) $(OBJECTS)


gerd's avatar
gerd committed
26 27
sample: sample.ml 
	ocamlfind ocamlc \
Gerd Stolpmann's avatar
Gerd Stolpmann committed
28
	  -package xstrp4 -syntax camlp4o -linkpkg \
gerd's avatar
gerd committed
29 30 31
	  sample.ml \
	  -o sample

gerd's avatar
gerd committed
32
view.sample: all
gerd's avatar
gerd committed
33 34 35 36 37 38
	camlp4 $(ROPTIONS) pa_o.cmo ./xstrp4.cma pr_o.cmo sample.ml

#----------------------------------------------------------------------
# general rules:

OPTIONS   =
Gerd Stolpmann's avatar
Gerd Stolpmann committed
39 40
OCAMLC    = $(OCAMLFIND) ocamlc -g $(STRING_OPTS) $(OPTIONS) $(CAMLP4_OPTS) -package "$(REQUIRES)"
OCAMLOPT  = $(OCAMLFIND) ocamlopt -g $(STRING_OPTS) $(OPTIONS) $(CAMLP4_OPTS) -package "$(REQUIRES)"
gerd's avatar
gerd committed
41 42 43 44 45 46 47 48 49 50
OCAMLDEP  = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind

#depend: *.ml *.mli
#	$(OCAMLDEP) *.ml *.mli >depend

*.mli:

.PHONY: install
install: all
51 52
	$(OCAMLFIND) install $(NAME) *.cmi *.cma META \
		-patch-version `./configure -version`
gerd's avatar
gerd committed
53 54 55 56 57 58 59

.PHONY: uninstall
uninstall:
	$(OCAMLFIND) remove $(NAME)

.PHONY: clean
clean:
gerd's avatar
gerd committed
60
	rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa sample
gerd's avatar
gerd committed
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

.PHONY: distclean
distclean: clean
	rm -f *~ depend depend.pkg

RELEASE: META
	awk '/version/ { print substr($$3,2,length($$3)-2) }' META >RELEASE

.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll

.ml.cmx:
	$(OCAMLOPT) -c $<

.ml.cmo:
	$(OCAMLC) -c $<

.mli.cmi:
	$(OCAMLC) -c $<

.mll.ml:
	ocamllex $<

xstrp4_here_lexer.cmo: xstrp4_here_types.cmo xstrp4_here_types.cmi
xstrp4_here_lexer.cmi: xstrp4_here_types.cmi
xstrp4_here.cmo: xstrp4_here_lexer.cmo xstrp4_here_lexer.cmi
xstrp4_here.cmi: xstrp4_here_lexer.cmi