Skip to content

Commit

Permalink
Merge pull request #28 from bbc2/readme
Browse files Browse the repository at this point in the history
Clarify and fix readme
  • Loading branch information
bbc2 authored Apr 20, 2024
2 parents 3f67dd6 + ca17771 commit 04d55f5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
DUNE ?= dune

.PHONY: all
all:
$(DUNE) build @install @example
dune build @install @example

.PHONY: test
test:
$(DUNE) runtest
dune runtest

.PHONY: clean
clean:
rm -rf _build
dune clean

.PHONY: tag
tag:
dune-release tag

.PHONY: distrib
distrib:
dune-release distrib

.PHONY: publish
publish:
dune-release publish


.PHONY: test all clean tag distrib publish
38 changes: 18 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
ppx_blob
========
# ppx_blob

OCaml ppx to include a binary blob from a file as a string. Writing `[%blob
"filename"]` will replace the string with the contents of the file at
compile time. This allows the inclusion of arbitrary, possibly compressed, data,
without the need to respect OCaml's lexical conventions.
This is an OCaml PPX to include a binary blob from a file as a string. Writing
`[%blob "filename"]` will replace the string with the contents of the file at compile
time. This allows the inclusion of arbitrary, possibly compressed, data, without the need
to respect OCaml's lexical conventions.

The filename can be relative to either the source file where `[%blob]` appears, or relative to the current working directory. If both files exist, the former takes precedence.
The filename can be relative to either the source file where `[%blob]` appears, or
relative to the current working directory. If both files exist, the former takes
precedence.

To build
--------
## Integration with build systems

Requires OCaml 4.02 or above.
### Dune

Run `make` in the top directory. Then run `make` in the `examples` directory.
Now run the `quine` executable.
Add `(preprocessor_deps (file path/to/file))` to your library or executable stanza. See
[test/dune](test/dune) for an example. This will make sure the file is copied to the build
directory and therefore visible to `ppx_blob`.

To install
----------
## Development

Run `make install` in the top directory once `make` has been run.
Requirements:

Integration with build systems
------------------------------
- OCaml 4.08+
- Packages: see [ppx_blob.opam](ppx_blob.opam).

**dune**

Add `(preprocessor_deps filename)` to your filename stanza. See https://github.com/johnwhitington/ppx_blob/tree/master/test for an example. This will make sure the file is copied to the build directory and therefore visible to `ppx_blob`.
Run `make` and `make test`.

0 comments on commit 04d55f5

Please sign in to comment.