1
# Makefile for the core language implementation
4
## Includes ###############################################################
8
include $(TOP)/mk/config.mk
9
include $(TOP)/mk/paths.mk
11
## Directories ############################################################
14
OUT_P = $(CORE_OUT_DIR)/prof
16
## Phony targets ##########################################################
18
.PHONY : default clean
20
## Default target #########################################################
22
default : $(OUT)/agdacore
24
## Files ##################################################################
26
gen_hs_files = $(OUT)/Core/Par.hs $(OUT)/Core/Lex.hs $(OUT)/Core/Abs.hs \
28
all_hs_files = $(shell $(FIND) . -name '*hs') $(gen_hs_files)
30
## Creating the output directory structure ################################
32
dirs = $(shell $(FIND) . -type d -not -name CVS)
33
out_dirs = $(patsubst .%,$(OUT)%,$(dirs))
34
out_dirs_p = $(filter-out .,$(patsubst .%,$(OUT_P)%,$(dirs)))
36
$(out_dirs) $(out_dirs_p) :
39
## Boot files pre 6.4 #####################################################
41
# Before ghc 6.4 you wrote hi-boot files. In 6.4 you write hs-boot files
42
# which ghc compiles into hi-boot files (with a very different format from
43
# the ones you wrote by hand). So if we are compiling with a pre-6.4 ghc
44
# we have to copy the hand-written hi-boot files to the out directory.
46
ifeq ($(HAVE_GHC_6_4),No)
48
src_hi_boot_files = $(shell $(FIND) . -name '*.hi-boot')
49
hi_boot_files = $(patsubst ./%,$(OUT)/%,$(src_hi_boot_files))
50
hi_boot_files_p = $(patsubst ./%,$(OUT_P)/%,$(src_hi_boot_files))
52
$(OUT)/%.hi-boot : $(hi_boot_files) : %.hi-boot
55
$(OUT_P)/%.hi-boot : $(hi_boot_files_p) : %.hi-boot
60
## Compiling agda #########################################################
62
GHC_FLAGS += -fno-warn-incomplete-patterns -fno-warn-overlapping-patterns
64
$(OUT)/agdacore : $(out_dirs) $(all_hs_files) $(hi_boot_files)
65
$(GHC) --make -o $@ -odir $(OUT) -hidir $(OUT) -i$(OUT) $(GHC_FLAGS) Main.hs
67
$(OUT_P)/agdacore : $(out_dirs_p) $(all_hs_files) $(hi_boot_files_p)
68
$(GHC) --make -o $@ -odir $(OUT_P) -hidir $(OUT_P) -i$(OUT) $(GHC_FLAGS) Main.hs -prof -auto-all
70
## BNFC rules #############################################################
72
$(OUT)/%/Par.y $(OUT)/%/Lex.x $(OUT)/%/Abs.hs : %.cf
77
## Rules for happy and alex ###############################################
80
$(ALEX) $(ALEX_FLAGS) $< -o $@
83
$(HAPPY) $(HAPPY_FLAGS) --info=$*.happy.out $< -o $@
85
## Clean ##################################################################
88
rm -f $(generated_files)