aboutsummaryrefslogtreecommitdiff
path: root/src/Makefile
blob: c7685e9236649304254730aa159ed40b33fc0e26 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
TOP = ..
include $(TOP)/mk/boilerplate.mk

INSTALLING=1

ghc_ge_504 = $(shell if (test $(GhcCanonVersion) -ge 504); then echo YES; else echo NO; fi)

# Don't use any hslibs packages in GHC >= 5.04
ifeq "$(ghc_ge_504)" "YES"
SRC_HC_OPTS += -package network -fglasgow-exts -cpp
else
SRC_HC_OPTS += -package data -package text -package util -package net -fglasgow-exts -cpp
endif

HS_PROG = haddock.bin

HsParser_HC_OPTS      += -Onot
HaddockParse_HC_OPTS  += -Onot
HaddockVersion_HC_OPTS = -DHADDOCK_VERSION=$(ProjectVersion)

HaddockVersion : ../mk/version.mk

ifeq "$(INSTALLING)" "1"
ifeq "$(BIN_DIST)"   "1"
HADDOCKLIB=$$\"\"libdir/haddock
HADDOCKBIN=$$\"\"libexecdir/$(HS_PROG)
else
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
# --mixed is only provided by newer versions of cygpath (1.2 doesn't have it, for instance.)
#HADDOCKLIB=$(shell cygpath --mixed $(libdir))
HADDOCKLIB=$(shell cygpath -w $(libdir) | sed -e 's%\\%/%g')
else
HADDOCKLIB=$(libdir)
endif # mingw
HADDOCKBIN=$(libexecdir)/$(HS_PROG)
endif # BIN_DIST
else
ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
# See above comment re: --mixed
#HADDOCKLIB=$(shell cygpath --mixed $(FPTOOLS_TOP_ABS)/haddock/html)
HADDOCKLIB=$(shell cygpath -w $(FPTOOLS_TOP_ABS)/haddock/html | sed -e 's%\\%/%g')
else
HADDOCKLIB=$(FPTOOLS_TOP_ABS)/haddock/html
endif
HADDOCKBIN=$(FPTOOLS_TOP_ABS)/haddock/src/$(HS_PROG)
endif # INSTALLING

HAPPY_OPTS += $(GHC_HAPPY_OPTS)

INSTALLED_SCRIPT_PROG  = haddock-$(ProjectVersion)
INPLACE_SCRIPT_PROG    = haddock-inplace

ifeq "$(INSTALLING)" "1"
TOP_PWD 	:= $(prefix)
SCRIPT_PROG 	=  $(INSTALLED_SCRIPT_PROG)
LINK	 	=  haddock
else
TOP_PWD 	:= $(FPTOOLS_TOP_ABS)
SCRIPT_PROG 	=  $(INPLACE_SCRIPT_PROG)
endif

SCRIPT_OBJS=haddock.sh

INTERP=$(SHELL)

SCRIPT_SUBST_VARS = HADDOCKLIB HADDOCKBIN

INSTALL_SCRIPTS += $(SCRIPT_PROG)
INSTALL_LIBEXECS = $(HS_PROG)

# don't recurse on 'make install'
#
ifeq "$(INSTALLING)" "1"
all clean distclean maintainer-clean ::
	$(MAKE) INSTALLING=0 BIN_DIST=0 $(MFLAGS) $@
endif

include $(TOP)/mk/target.mk