-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (92 loc) · 4.27 KB
/
Makefile
File metadata and controls
126 lines (92 loc) · 4.27 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# WARNING: This Makefile is largely redundant with the .cabal file and will be deleted at some point.
# It has some crufty shortcuts used by the developers.
#====================================================================================================
all: release
ifeq (,$(GHC))
GHC= ghc
endif
#====================================================================================================
# Below is the (entirely separate) makefile for the translator.
#====================================================================================================
HSOURCE=SrcLoc.hs Main.hs GatherGraph.hs AST.hs Codegen/CppOld.hs Codegen/Haskell.hs \
CncGraph.hs CncViz.hs TraceVacuum.hs Curses.hs Util.hs \
Passes/ReadHarch.hs Passes/ReadCnC.hs Passes/TypeDefs.hs
ifeq (,$(BUILDDIR))
BUILDDIR= ./build/
endif
#BUILDDIR= ./
HCNCNAME=cnc
$(BUILDDIR):
mkdir $(BUILDDIR)
# This is for use in the context of a complete Intel CnC distribution.
install:
rm -f Intel/Cnc/Spec/Version.hs
# $(MAKE) Intel/Cnc/Spec/Version.hs $(HCNCNAME).stripped
# cp $(BUILDDIR)/$(HCNCNAME).stripped `which $(HCNCNAME)`
$(MAKE) Intel/Cnc/Spec/Version.hs release
if [ -e ../../distro/ ]; then mkdir -p ../../distro/bin/$(CNC_ARCH_PLATFORM)/; fi
if [ -e ../../distro/ ]; then cp $(BUILDDIR)/$(HCNCNAME).release ../../distro/bin/$(CNC_ARCH_PLATFORM)/cnc; fi
trans_inplace:
GHCFLAGS="$(GHCFLAGS) -c" BUILDDIR=./ $(MAKE) ./$(HCNCNAME)
trans:
@echo
@echo ================================================================================
@echo Building Spec Translator/Compiler.
@echo ================================================================================
$(MAKE) $(BUILDDIR)/$(HCNCNAME)
Intel/Cnc/Spec/Version.hs:
runhaskell ./scripts/extract_version.hs
release:
GHCFLAGS="-rtsopts -O2" $(MAKE) $(BUILDDIR)/$(HCNCNAME).stripped
@echo Packing executable with UPX:
rm -f $(BUILDDIR)/$(HCNCNAME).release
upx $(BUILDDIR)/$(HCNCNAME).stripped -o $(BUILDDIR)/$(HCNCNAME).release
$(BUILDDIR)/$(HCNCNAME).stripped: viz
@echo Stripping executable to reduce size.
strip $(BUILDDIR)/$(HCNCNAME) -o $(BUILDDIR)/$(HCNCNAME).stripped
$(BUILDDIR)/$(HCNCNAME): $(BUILDDIR) preproc buildtrans
buildtrans:
$(GHC) $(GHCFLAGS) --make Intel/Cnc/Spec/Main.hs -odir $(BUILDDIR) -o $(BUILDDIR)/$(HCNCNAME) -fwarn-unused-imports
viz: $(BUILDDIR) $(BUILDDIR) preproc
# $(GHC) $(GHCFLAGS) -c Intel/Cnc/Spec/CncLexer.hs
$(GHC) -odir $(BUILDDIR) -c Intel/Cnc/Spec/CncLexer.hs
$(GHC) $(GHCFLAGS) -DCNCVIZ --make Intel/Cnc/Spec/Main.hs -odir $(BUILDDIR) -o $(BUILDDIR)/$(HCNCNAME)
preproc: Intel/Cnc/Spec/CncLexer.hs Intel/Cnc/Spec/CncGrammar.hs
Intel/Cnc/Spec/CncLexer.hs: Intel/Cnc/Spec/CncLexer.x
alex Intel/Cnc/Spec/CncLexer.x
Intel/Cnc/Spec/CncGrammar.y: Intel/Cnc/Spec/CncGrammar.y.pp
cpp -P -CC $^ $@
# gcc -x c -E $^ -o $@
Intel/Cnc/Spec/CncGrammar.hs: Intel/Cnc/Spec/CncGrammar.y
happy Intel/Cnc/Spec/CncGrammar.y
wctrans:
(cd Intel/Cnc/Spec/; ln -f -s CncLexer.x CncLexer.temp.hs)
(cd Intel/Cnc/Spec/; ln -f -s CncGrammar.y.pp CncGrammar.temp.hs)
(cd Intel/Cnc/Spec/; cloc-1.08.pl --by-file CncLexer.temp.hs CncGrammar.temp.hs $(HSOURCE))
#====================================================================================================
clean: cleanruntime cleantrans cleantests
runhaskell ./Setup.hs clean
cleanruntime:
rm -f ./Intel/*.o ./Intel/*.hi Intel/*~
rm -f ./Intel/Cnc/*.o Intel/Cnc/*.hi
rm -f $(BUILDDIR)/Intel/*.o $(BUILDDIR)/Intel/*.hi
rm -f $(BUILDDIR)/Intel/Cnc/*.o $(BUILDDIR)/Intel/Cnc/*.hi
rm -f *.aux little*.log
(cd examples; $(MAKE) clean)
cleantrans:
rm -rf $(BUILDDIR)/$(HCNCNAME) $(BUILDDIR)/$(HCNCNAME).*
(cd $(BUILDDIR)/Intel/Cnc/Spec; find -name "*.o" | xargs -i rm {} )
(cd $(BUILDDIR)/Intel/Cnc/Spec; find -name "*.hi" | xargs -i rm {} )
(cd ./Intel/Cnc/Spec; find -name "*.o" | xargs -i rm {} )
(cd ./Intel/Cnc/Spec; find -name "*.hi" | xargs -i rm {} )
cleantests:
(cd tests_spec; $(MAKE) clean)
#====================================================================================================
pkgtest:
rm -rf dist/cnc-spec-compiler-*
cabal sdist
(cd dist; tar xzvf cnc-spec-compiler-*.tar.gz)
(cd dist/cnc-spec-compiler-*/ && cabal install)
# cd graphPartitioner; $(MAKE)
# Prevent odd make builtin rules re: cnc.sh
.SUFFIXES: