Makefile 2.36 KB
Newer Older
bbr's avatar
bbr committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
BIN = bin/
SRC = src/
LIB = $(SRC)lib/
DIST = dist/
THIS = ../kics/
KGHC = ghc --make -fglasgow-exts -i$(LIBS) -H500m
GHC  = ghc --make -fglasgow-exts -i$(SRC)  -H500m
LIBS = $(shell $(BIN)kicslib)

all: $(SRC)InstallDir.hs $(BIN)generate $(BIN)kicslib $(BIN)kics $(BIN)kicsi libs

.PHONY: tools
tools: $(SRC)InstallDir.hs $(BIN)makeExternalInterface 

bbr's avatar
bbr committed
15
$(BIN)generate: $(SRC)InstallDir.hs $(SRC)Generate.hs $(SRC)CurryToHaskell.hs $(SRC)PreTrans.hs
bbr's avatar
bbr committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
	$(GHC) $(SRC)Generate.hs -o $(BIN)generate
	cd $(SRC)
	$(BIN)generate $(SRC)
	cd ..

$(SRC)InstallDir.hs: 
	echo "module InstallDir where"  >  $(SRC)InstallDir.hs
	echo "installDir = \""`pwd`"\"" >> $(SRC)InstallDir.hs

$(BIN)kicslib: $(SRC)InstallDir.hs $(SRC)kicslib.hs $(SRC)Config.hs
	mkdir -p bin 
	ghc -fglasgow-exts -i$(SRC) --make $(SRC)kicslib -o $(BIN)kicslib

$(BIN)makeExternalInterface: $(SRC)InstallDir.hs $(BIN)kicslib
	$(KGHC) $(SRC)MakeExternalInterface -o $(BIN)makeExternalInterface

bbr's avatar
bbr committed
32
$(BIN)kicsi: $(BIN)kicslib $(SRC)CurryToHaskell.hs $(SRC)kicsi.hs $(SRC)PreTrans.hs
bbr's avatar
bbr committed
33
34
35
36
37
38
39
40
41
ifeq (,$(filter readline%,$(shell ghc-pkg list readline)))
	@echo no readline package found
	cp $(SRC)NoReadline.make $(SRC)MyReadline.hs
else
	@echo readline package found
	cp $(SRC)WithReadline.make $(SRC)MyReadline.hs
endif
	$(KGHC) $(SRC)kicsi -o $(BIN)kicsi

bbr's avatar
bbr committed
42
$(BIN)kics:  $(BIN)kicslib $(SRC)CurryToHaskell.hs $(SRC)PreTrans.hs
bbr's avatar
bbr committed
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
79
80
81
	$(KGHC) $(SRC)kics -o $(BIN)kics

.PHONY: runtime
runtime: $(SRC)InstallDir.hs  
	$(KGHC) --make $(SRC)Curry.hs

.PHONY: libs 
libs: $(BIN)kics runtime
	$(BIN)kics -v -make $(LIB)All_Libraries

.PHONY: clean
clean:
	rm -f *.o *.hi $(LIB)*.o $(LIB)*.hi $(SRC)*.o $(SRC)*.hi test/*.o test/*.hi

.PHONY: mrproper
mrproper: clean
	rm -f $(SRC)InstallDir.hs
	rm -f $(SRC)AutoGenerated*.hs
	rm -f $(LIB)Curry*.hs $(LIB)Data*.hs $(LIB)Instances*.hs $(LIB)*.fcy $(LIB)*.fint\
              test/Curry*.hs  test/Data*.hs  test/Instances*.hs  test/*.fcy  test/*.fint


.PHONY: dist
dist: 
	mkdir -p dist
	rm -f $(SRC)InstallDir.hs
	tar czf $(THIS)$(DIST)kics_src.tgz\
	  $(THIS)$(LIB)*.curry \
	  $(THIS)$(LIB)/ExternalData*.hs \
	  $(THIS)$(LIB)/ExternalInstances*.hs \
	  $(THIS)$(LIB)/ExternalFunctions*.hs \
	  $(THIS)$(LIB)/External*.spec \
	  $(THIS)$(SRC)*.hs\
	  $(THIS)$(SRC)*.make\
	  $(THIS)Makefile $(THIS)INSTALL\
	  $(THIS)$(BIN)kghc
	cp $(THIS)$(DIST)kics_src.tgz ~/public_html/download/
	chmod a+r ~/public_html/download/kics_src.tgz