| 1 | # |
|---|
| 2 | # C2Newspeak: compiles C code into Newspeak. Newspeak is a minimal language |
|---|
| 3 | # well-suited for static analysis. |
|---|
| 4 | # Copyright (C) 2007, 2011 Charles Hymans, Olivier Levillain, Sarah Zennou |
|---|
| 5 | # |
|---|
| 6 | # This library is free software; you can redistribute it and/or |
|---|
| 7 | # modify it under the terms of the GNU Lesser General Public |
|---|
| 8 | # License as published by the Free Software Foundation; either |
|---|
| 9 | # version 2.1 of the License, or (at your option) any later version. |
|---|
| 10 | # |
|---|
| 11 | # This library is distributed in the hope that it will be useful, |
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 14 | # Lesser General Public License for more details. |
|---|
| 15 | # |
|---|
| 16 | # You should have received a copy of the GNU Lesser General Public |
|---|
| 17 | # License along with this library; if not, write to the Free Software |
|---|
| 18 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | # |
|---|
| 20 | # |
|---|
| 21 | # Charles Hymans |
|---|
| 22 | # charles.hymans@penjili.org |
|---|
| 23 | # |
|---|
| 24 | # Sarah Zennou |
|---|
| 25 | # sarah(dot)zennou(at)eads(dot)net |
|---|
| 26 | |
|---|
| 27 | VERSION=1.7 |
|---|
| 28 | |
|---|
| 29 | #utils |
|---|
| 30 | CP=cp |
|---|
| 31 | RM=rm -rf |
|---|
| 32 | OCAMLDOC=ocamldoc |
|---|
| 33 | |
|---|
| 34 | #FILES |
|---|
| 35 | EXE=c2newspeak npkstrip npkstats \ |
|---|
| 36 | npkcheck ada2newspeak \ |
|---|
| 37 | simpleai npkmerger ptrtype |
|---|
| 38 | COMPONENTS=newspeak $(EXE) |
|---|
| 39 | |
|---|
| 40 | CLEANFILES=*~ bin/* lib/*~ lib/sys/*~ doc/*.html doc/*~ src/version.cmo src/*~ \ |
|---|
| 41 | bisect-report.xml bisect-report/* |
|---|
| 42 | |
|---|
| 43 | #rules |
|---|
| 44 | .PHONY: clean doc lib bisect-report |
|---|
| 45 | |
|---|
| 46 | all: bin $(COMPONENTS) doc lib |
|---|
| 47 | |
|---|
| 48 | # for bisect support you may need the latest version |
|---|
| 49 | # darcs get http://bisect.x9c.fr |
|---|
| 50 | coverage: |
|---|
| 51 | @echo "Generating coverage report" |
|---|
| 52 | $(MAKE) WITH_BISECT=1 |
|---|
| 53 | $(MAKE) check |
|---|
| 54 | cd src/ ; bisect-report `find ../tests/ -name bisect*` \ |
|---|
| 55 | -html ../../cov/$(shell date +%Y%m%d%H%M) |
|---|
| 56 | ln -nsf ./$(shell date +%Y%m%d%H%M) ../cov/LATEST |
|---|
| 57 | |
|---|
| 58 | lib: bin bin/lib/assert.h |
|---|
| 59 | |
|---|
| 60 | bin/lib/assert.h: |
|---|
| 61 | @-mkdir bin/lib |
|---|
| 62 | @echo "Copying libraries in "bin/lib |
|---|
| 63 | @$(CP) -r lib/* bin/lib |
|---|
| 64 | |
|---|
| 65 | bin: |
|---|
| 66 | @mkdir bin |
|---|
| 67 | |
|---|
| 68 | #WARNING: do not remove the $(MAKECMDGOALS) variable, it is useful to propagate |
|---|
| 69 | #the rule. |
|---|
| 70 | #For instance, both rules 'clean' and 'all' have the prerequisite $(COMPONENTS) |
|---|
| 71 | #When doing make clean, this rule will be called with $(MAKECMDGOALS) |
|---|
| 72 | #equal to clean |
|---|
| 73 | #Whereas, when doing make all, this rule will be called with $(MAKECMDGOALS) |
|---|
| 74 | #equal to all |
|---|
| 75 | $(COMPONENTS): src/version.ml |
|---|
| 76 | @$(MAKE) -s -C src -f $@.Makefile $(MAKECMDGOALS) |
|---|
| 77 | |
|---|
| 78 | bisect-report: |
|---|
| 79 | cd src; bisect-report `find ../tests/ -name "bisect*.out"` -xml-emma ../bisect-report.xml -html ../bisect-report |
|---|
| 80 | |
|---|
| 81 | doc: doc/index.html |
|---|
| 82 | |
|---|
| 83 | doc/index.html: src/newspeak/newspeak.mli |
|---|
| 84 | @echo "Generating documentation in "doc/ |
|---|
| 85 | @$(OCAMLDOC) -I src -I src/newspeak src/newspeak/newspeak.mli src/newspeak/newspeak.ml -html -d doc -css-style newspeak.css -t "Newspeak - doubleplussimple minilang for static analysis (v. $(VERSION))" -intro doc/npkintro.mldoc -colorize-code |
|---|
| 86 | |
|---|
| 87 | clean: $(COMPONENTS) |
|---|
| 88 | @echo "Cleaning files installed in "bin/, doc/ |
|---|
| 89 | @$(RM) $(CLEANFILES) |
|---|