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

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

Function pointers in D2.2/8051. Bugged for now.

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