File: Makefile

package info (click to toggle)
haskell-utils 1.6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 104 kB
  • ctags: 13
  • sloc: haskell: 411; makefile: 87
file content (56 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download
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

.PHONY: all install clean compiler_name

version=1.6
prefix := /usr/local
libdir := $(prefix)/lib
localstatedir := $(prefix)/lib
COMPILER := $(shell \
    if [ -e /usr/bin/ghc6 ]; then echo /usr/bin/ghc6; \
  elif [ -e /usr/bin/ghc5 ]; then echo /usr/bin/ghc5; \
  elif [ -e /usr/bin/nhc98 ] && \
       [ -e /usr/bin/hmake ]; then echo /usr/bin/nhc98; \
  elif [ -e /usr/bin/hugs ]; then echo /usr/bin/hugs; \
  else exit 1; fi)
COMPILER_NAME := $(notdir $(COMPILER))
COMPILER_FLAGS := -O2 -Wall

PROGRAMS=haskell-utils update-haskell-control
SOURCES=$(addsuffix .lhs,$(PROGRAMS))
MANPAGES=$(addsuffix .1,$(PROGRAMS))

all: $(PROGRAMS) $(MANPAGES)

$(PROGRAMS): %: %.lhs
ifeq "$(COMPILER_NAME)" "hugs"
	(echo "#!/usr/bin/runhugs +l"; cat $<) > $@
	chmod +x $@
else
ifeq "$(COMPILER_NAME)" "nhc98"
	HFLAGS="-H10M" /usr/bin/hmake -hc=/usr/bin/nhc98 -package base $(COMPILER_FLAGS) $@
else
	$(COMPILER) $(COMPILER_FLAGS) $< -o $@
endif
endif

$(SOURCES) $(MANPAGES): %: %.in
	cpphs -DCOMPILER$(COMPILER_NAME) $< \
	 | sed -e "s@^#line.*@@" \
	       -e "s#@version@#$(version)#g" \
	       -e "s#@libdir@#$(libdir)#g" \
	       -e "s#@localstatedir@#$(localstatedir)#g" \
	 > $@

install: $(PROGRAMS)
	install -d $(prefix)/sbin/
	install -d $(prefix)/bin/
	install haskell-utils $(prefix)/sbin/
	install update-haskell-control $(prefix)/bin/
	install -d $(localstatedir)/haskell-utils/

clean:
	rm -f *.o *.hi $(PROGRAMS) $(MANPAGES) $(SOURCES)

compiler_name:
	@echo $(COMPILER_NAME)