Debian Codegraph @

Makefile

raw symbols SCIP
1 ############################################################################
2 # Copyright © 2012-2015 Mehdi Dogguy <[email protected]> #
3 # #
4 # This file is part of Dochelp. #
5 # #
6 # Dochelp is free software: you can redistribute it and/or modify it #
7 # under the terms of the GNU General Public License as published by the #
8 # Free Software Foundation, either version 3 of the License, or (at your #
9 # option) any later version. #
10 # #
11 # Dochelp is distributed in the hope that it will be useful, but WITHOUT #
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License #
14 # for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with Dochelp. If not, see <http://www.gnu.org/licenses/>. #
18 ############################################################################
19
20 # Configuration
21 NAME := dochelp
22 PREFIX := /usr/local
23 DESTDIR:=
24
25 # Auto-detection
26 ifeq ($(OCAMLBEST),)
27 HAS_OPT := $(shell if which ocamlopt > /dev/null; then echo yes; fi)
28 else ifeq ($(OCAMLBEST),native)
29 HAS_OPT := yes
30 else
31 HAS_OPT :=
32 endif
33 OCAML_STDLIB_DIR ?= $(DESTDIR)/$(shell /usr/bin/ocamlc -where)
34
35 CLASSIC := $(if $(INSIDE_EMACS), -classic-display)
36 ARCH := $(if $(HAS_OPT),native,byte)
37 OCAMLBUILD := ocamlbuild$(CLASSIC)$(if $(HAS_OPT),, -byte-plugin)
38 OCAMLBUILD_ENV :=
39
40 # Build
41 TARGETS := src/$(NAME).$(ARCH)
42
43 # C stubs magic for bytecode
44 export CAML_LD_LIBRARY_PATH=$(CURDIR)/_build/src
45
46 # Installation
47 BINDIR := $(PREFIX)/bin
48
49 all: build man
50
51 build:
52 $(OCAMLBUILD_ENV) $(OCAMLBUILD) $(TARGETS)
53
54 man: build
55 ./$(NAME).$(ARCH) --help=groff > $(NAME).1
56
57 typerex: OCAMLBUILD_ENV := OCAMLFIND_COMMANDS='ocamlc=ocp-ocamlc ocamlopt=ocp-ocamlopt'
58 typerex: build
59
60 clean:
61 $(OCAMLBUILD) -clean
62 -rm $(NAME).1
63
64 headers:
65 headache -r -c .headache/config -h .headache/header Makefile \
66 $(wildcard *.ml src/*.ml src/*.mli src/*.mly src/*.mll src/*.c media/*.js media/styles.css)
67
68 install:
69 install -d $(BINDIR)
70 install _build/src/$(NAME).$(ARCH) $(BINDIR)/$(NAME)
71 ifeq ($(HAS_OPT),)
72 install -d $(OCAML_STDLIB_DIR)/stublibs
73 install _build/src/dlldochelp.so $(OCAML_STDLIB_DIR)/stublibs/dlldochelp.so
74 endif
75 install -d $(PREFIX)/share/applications/
76 install dochelp.desktop $(PREFIX)/share/applications/