source: Deliverables/D2.2/8051/Makefile.generic @ 486

Last change on this file since 486 was 486, checked in by ayache, 8 years ago

Deliverable D2.2

File size: 2.5 KB
Line 
1# -*- Makefile -*-
2BTARGET  = $(TARGET).byte
3OTARGET  = $(TARGET).native
4BLTARGET = $(TARGET).cma
5BNTARGET = $(TARGET).cmxa
6STARGET  = $(shell if `which ocamlopt`; then \
7                   echo $(OTARGET);          \
8              else echo $(BTARGET); fi)
9
10TESTDIR  = tests
11
12#########################
13## Tools configuration ##
14#########################
15
16# Menhir can be told to produce a parser that explains what
17# it is doing.
18ifeq ($(DEBUGPARSING), yes)
19  MENHIROPT=-yaccflag --explain -yaccflag --trace
20else
21  MENHIROPT=-yaccflag --explain
22endif
23
24# In Emacs, use classic display to enable error jumping.
25TERM = $(shell echo $$TERM)
26OCAMLBUILDCMD=$(shell if `which ocamlopt`; then \
27                      echo "ocamlbuild";        \
28                 else echo "ocamlbuild -byte-plugin"; fi)
29ifeq ($(TERM), dumb)
30 OCAMLBUILD = $(OCAMLBUILDCMD) -cflag "-dtypes" -tag debug -classic-display -no-hygiene $(MENHIROPT)
31else
32 OCAMLBUILD = $(OCAMLBUILDCMD) -no-hygiene $(MENHIROPT) -lflags -I,`pwd`/lib
33endif
34
35OCAMLDOC = ocamldoc
36HEADACHE = headache
37
38#########
39# Rules #
40#########
41
42.PHONY: configure all-generic byte opt doc clean dist install uninstall headers clear
43
44all-generic: configure clear $(STARGET) $(TARGET) 
45
46$(TARGET):
47        ln -s $(STARGET) $(TARGET)
48
49clear:
50        rm -f $(STARGET)
51
52opt: $(OTARGET)
53
54byte: $(BTARGET)
55
56%:
57        @ $(OCAMLBUILD) src/$@
58
59byte-debug:
60        $(OCAMLBUILD) -tag debug src/$(BTARGET)
61
62ifeq ($(strip $(PREFIX)),)
63install uninstall:
64        @echo "Cannot (un)install $(EXECUTABLE): the PREFIX variable is undefined." && false
65else
66install: $(EXECUTABLE)
67        mkdir -p $(PREFIX)/bin/
68        install $(STARGET) $(PREFIX)/bin/$(TARGET)
69uninstall:
70        /bin/rm -f $(PREFIX)/bin/$(TARGET)
71endif
72
73#######################
74# Administrative part #
75#######################
76
77headers:
78        for i in src/*.ml src/*.mli src/*.mly; do \
79           $(HEADACHE) -h admin/header -c admin/headache.cfg $$i; \
80        done
81
82clean:
83        @ $(OCAMLBUILD) -clean
84        make -C cparser clean
85        make -C $(TESTDIR) clean
86        find -name '*~' -exec rm '{}' \;
87        rm -fr *~ $(TARGET) $(PACKAGE) $(PACKAGE).tar.gz
88
89doc: byte
90        $(OCAMLBUILD) $(TARGET).docdir/index.html
91        mkdir -p doc/html
92        rm -f $(TARGET).docdir/style.css 2> /dev/null
93        mv $(TARGET).docdir/* doc/html
94        rm $(TARGET).docdir
95
96dist:
97        rm -fr $(PACKAGE)
98        mkdir $(PACKAGE)
99        for i in `cat distributed_files` doc/html/*.html; do    \
100          if test -f $$i; then                                  \
101            cp -fr --parents $$i $(PACKAGE);                    \
102          else                                                  \
103            mkdir -p $$i;                                       \
104          fi;                                                   \
105        done
106        tar cvfz $(PACKAGE).tar.gz $(PACKAGE)
107
108check: all
109        $(MAKE) -C $(TESTDIR) check
Note: See TracBrowser for help on using the repository browser.