diff --git a/Makefile b/Makefile index 1d6a523..fb06360 100644 --- a/Makefile +++ b/Makefile @@ -1,45 +1,97 @@ +# Copyright (c) 2015 Richard Mortier +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + -include Makefile.config -# OASIS_START -# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954) +NAME = $(shell oasis query name) +VERSION = $(shell oasis query version) -SETUP = ocaml setup.ml +all byte native build: configure + ocaml setup.ml -build -build: setup.data - $(SETUP) -build $(BUILDFLAGS) +lib: build reinstall + [ ! -r bin/Makefile ] && mirage configure --no-depext bin/config.ml || true + mirage clean bin/config.ml -doc: setup.data build - $(SETUP) -doc $(DOCFLAGS) +tftpd: bin/tftpd +bin/tftpd: bin/config.ml bin/tftpd.ml + [ ! -r bin/Makefile ] && \ + mirage configure --unix bin/config.ml || true + mirage build bin/config.ml + cp bin/_build/main.native bin/tftpd -test: setup.data build - $(SETUP) -test $(TESTFLAGS) +configure setup.data: setup.ml + ocaml $< -configure --enable-tests -all: - $(SETUP) -all $(ALLFLAGS) +setup: setup.ml +setup.ml: _oasis + oasis setup -install: setup.data - $(SETUP) -install $(INSTALLFLAGS) +test doc install uninstall reinstall: all + ocaml setup.ml -$@ -uninstall: setup.data - $(SETUP) -uninstall $(UNINSTALLFLAGS) +## Documentation -reinstall: setup.data - $(SETUP) -reinstall $(REINSTALLFLAGS) +doc/html/.git: + mkdir -p doc/html + cd doc/html && ( \ + git init && \ + git remote add origin git@github.com:mor1/ocaml-tftp.git && \ + git checkout -B gh-pages \ + ) -clean: - $(SETUP) -clean $(CLEANFLAGS) +gh-pages: doc/html/.git + cd doc/html && git checkout -B gh-pages + rm -f doc/html/* + $(MAKE) doc && cp tftp.docdir/* doc/html/ + cd doc/html && ( \ + git add * && \ + git commit -a -m "Documentation updates" && \ + git push origin gh-pages \ + ) -distclean: - $(SETUP) -distclean $(DISTCLEANFLAGS) +## Publish + +ARCHIVE = https://github.com/mor1/ocaml-tftp/archive/$(VERSION).tar.gz + +opam: release publish pr -setup.data: - $(SETUP) -configure $(CONFIGUREFLAGS) +release: + git tag -a $(VERSION) -m "Version $(VERSION)." + git push upstream $(VERSION) -configure: - $(SETUP) -configure $(CONFIGUREFLAGS) +publish: + OPAMYES=1 opam pin add -n . + opam publish prepare $(NAME).$(VERSION) $(ARCHIVE) -.PHONY: build doc test all install uninstall reinstall clean distclean configure +pr: + OPAMYES=1 opam pin add -n $(NAME) $(NAME).$(VERSION) + opam publish submit $(NAME).$(VERSION) && $(RM) -r $(NAME).$(VERSION) -# OASIS_STOP --include Makefile.local +## Clean + +clean: + ocaml setup.ml -clean + [ -r bin/Makefile ] && mirage clean bin/config.ml || true + $(RM) log bin/tftpd + +distclean: + ocaml setup.ml -distclean + oasis setup-clean + $(RM) setup.* _tags configure myocamlbuild.ml + $(RM) lib/META lib/*.ml*lib lib/*.mlpack + +.PHONY: all byte native build doc test install uninstall reinstall \ + clean distclean configure setup diff --git a/Makefile.local b/Makefile.local deleted file mode 100644 index 7525b0c..0000000 --- a/Makefile.local +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (c) 2015 Richard Mortier -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -## Oasis targets - -setup-clean: clean distclean - oasis setup-clean - $(RM) setup.* _tags configure myocamlbuild.ml - $(RM) lib/META lib/*.ml*lib lib/*.mlpack - -setup.ml: _oasis - oasis setup - -setup: setup.ml setup.data - -## Mirage targets - -clean: - $(SETUP) -clean $(CLEANFLAGS) - [ -r bin/Makefile ] && mirage clean bin/config.ml || true - $(RM) log bin/tftpd - -lib: build reinstall - [ ! -r bin/Makefile ] && mirage configure --no-depext bin/config.ml || true - mirage clean bin/config.ml - -tftpd: bin/tftpd -bin/tftpd: bin/config.ml bin/tftpd.ml - [ ! -r bin/Makefile ] && \ - mirage configure --unix bin/config.ml || true - mirage build bin/config.ml - cp bin/_build/main.native bin/tftpd - -## Documentation - -doc/html/.git: - mkdir -p doc/html - cd doc/html && ( \ - git init && \ - git remote add origin git@github.com:mor1/ocaml-tftp.git && \ - git checkout -B gh-pages \ - ) - -gh-pages: doc/html/.git - cd doc/html && git checkout -B gh-pages - rm -f doc/html/* - $(MAKE) doc && cp tftp.docdir/* doc/html/ - cd doc/html && ( \ - git add * && \ - git commit -a -m "Documentation updates" && \ - git push origin gh-pages \ - ) - -## Release targets - -VERSION = $(shell grep '^Version:' _oasis | sed 's/Version: *//') -NAME = $(shell grep '^Name:' _oasis | sed 's/Name: *//') -ARCHIVE = https://github.com/mor1/ocaml-tftp/archive/$(VERSION).tar.gz - -opam: release publish pr - -release: - git tag -a $(VERSION) -m "Version $(VERSION)." - git push upstream $(VERSION) - -publish: - OPAMYES=1 opam pin add -n . - opam publish prepare $(NAME).$(VERSION) $(ARCHIVE) - -pr: - OPAMYES=1 opam pin add -n $(NAME) $(NAME).$(VERSION) - opam publish submit $(NAME).$(VERSION) && $(RM) -r $(NAME).$(VERSION) diff --git a/_oasis b/_oasis index 0039e7c..063c544 100644 --- a/_oasis +++ b/_oasis @@ -1,25 +1,32 @@ OASISFormat: 0.4 Name: tftp Version: 0.1.3 -Synopsis: Trivial FTP +Synopsis: A TFTP library and Mirage unikernel +Description: A basic implementation of the + [Trivial FTP](https://tools.ietf.org/html/rfc1350) + protocol. Provides separate wire parsing and server libraries, plus a + [MirageOS](https://mirage.io/) unikernel server implementation. Authors: Richard Mortier +Maintainers: Richard Mortier +Homepage: https://github.com/mor1/ocaml-tftp License: ISC Plugins: META (0.4), DevFiles (0.4) BuildTools: ocamlbuild +OCamlVersion: >= 4.01.0 Library "tftp-wire" Path: lib/ FindlibName: wire FindlibParent: tftp Modules: Wire - BuildDepends: cstruct, cstruct.syntax + BuildDepends: cstruct (>= 1.0.1), cstruct.syntax Library "tftp" Path: lib/ Pack: true Findlibname: tftp Modules: S - BuildDepends: mirage, lwt, tftp.wire, io-page + BuildDepends: mirage (>= 2.5.0), lwt (>= 2.4.7), tftp.wire, io-page Document tftp Title: TFTP docs @@ -28,3 +35,9 @@ Document tftp Install: true XOCamlbuildPath: lib/ XOCamlbuildLibraries: tftp.wire, tftp + + +SourceRepository master + Type: git + Location: https://github.com/mor1/ocaml-tftp.git + Browser: https://github.com/mor1/ocaml-tftp