Makefile 2.39 KB
Newer Older
gerd's avatar
gerd committed
1 2 3 4 5 6 7 8 9 10 11 12
# make all: 		make bytecode archive
# make opt: 		make native archive
# make install: 	install bytecode archive, and if present, native 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)

#----------------------------------------------------------------------
# specific rules for this package:

gerd's avatar
gerd committed
13 14 15 16 17 18 19 20
OBJECTS  = crypt_aux.cmo \
           cryptsystem_64.cmo cryptmodes_64.cmo \
	   crypt_blowfish.cmo crypt_des.cmo crypt_3des.cmo \
           crypt_blowfish32.cmo 
XOBJECTS = crypt_aux.cmx \
           cryptsystem_64.cmx cryptmodes_64.cmx \
	   crypt_blowfish.cmx crypt_des.cmx crypt_3des.cmx \
           crypt_blowfish32.cmx 
gerd's avatar
gerd committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
ARCHIVE  = cryptgps.cma
XARCHIVE = cryptgps.cmxa
NAME     = cryptgps
REQUIRES = 

all: $(ARCHIVE)

opt: $(XARCHIVE)

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

$(XARCHIVE): $(XOBJECTS)
	$(OCAMLOPT) -a -o $(XARCHIVE) $(XOBJECTS)

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

OPTIONS   =
OCAMLC    = ocamlc $(OPTIONS) $(ROPTIONS)
gerd's avatar
gerd committed
41
OCAMLOPT  = ocamlopt -p $(OPTIONS) $(ROPTIONS)
gerd's avatar
gerd committed
42 43 44 45 46 47 48 49 50 51 52 53
OCAMLDEP  = ocamldep $(OPTIONS)
OCAMLFIND = ocamlfind

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

depend.pkg: Makefile
	$(OCAMLFIND) use -p ROPTIONS= $(REQUIRES) >depend.pkg

.PHONY: install
install: all
	{ test ! -f $(XARCHIVE) || extra="*.cmxa *.a"; }; \
54
	$(OCAMLFIND) install $(NAME) *.mli *.cmi *.cma META $$extra
gerd's avatar
gerd committed
55 56 57 58 59 60 61 62 63 64 65

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

.PHONY: clean
clean:
	rm -f *.cmi *.cmo *.cma *.cmx *.o *.a *.cmxa

.PHONY: distclean
distclean: clean
gerd's avatar
gerd committed
66
	rm -f *~ depend depend.pkg
gerd's avatar
gerd committed
67 68 69 70
	(cd cmp_cryptgps; rm -f *~)
	$(MAKE) -C cmp_ssleay distclean
	$(MAKE) -C test distclean

gerd's avatar
gerd committed
71

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

gerd's avatar
gerd committed
75
.PHONY: dist
76
dist: RELEASE
gerd's avatar
gerd committed
77
	r=`head -1 RELEASE`; cd ..; gtar czf $(NAME)-$$r.tar.gz --exclude='*/CVS*' --exclude="*/depend.pkg" --exclude="*/depend" $(NAME)
gerd's avatar
gerd committed
78 79

.PHONY: tag-release
80
tag-release: RELEASE
gerd's avatar
gerd committed
81 82 83 84 85 86 87 88
	r=`head -1 RELEASE | sed -e s/\\\./-/g`; cd ..; cvs tag -F $(NAME)-$$r $(NAME)

.PHONY: release
release: distclean
	$(MAKE) tag-release
	$(MAKE) dist

.ml.cmx:
gerd's avatar
gerd committed
89
	$(OCAMLOPT) -inline 10000 -unsafe -c $<
gerd's avatar
gerd committed
90 91 92 93 94 95 96 97 98 99

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

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

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

include depend
gerd's avatar
gerd committed
100
include depend.pkg