1
# Makefile for full language.
4
## Includes ###############################################################
8
include $(TOP)/mk/config.mk
9
include $(TOP)/mk/paths.mk
11
## Directories ############################################################
14
OUT_P = $(FULL_OUT_DIR)/prof
16
## Source files ###########################################################
18
src_files = $(patsubst ./%,%,$(shell $(FIND) . -name '*.hs' -o -name '*.lhs'))
19
all_hs_files = $(src_files) $(OUT)/Agda/Syntax/Parser/Parser.hs \
20
$(OUT)/Agda/Syntax/Parser/Lexer.hs
21
all_hs_files_p = $(src_files) $(OUT_P)/Agda/Syntax/Parser/Parser.hs \
22
$(OUT_P)/Agda/Syntax/Parser/Lexer.hs
25
out_h_files = $(patsubst %,$(OUT)/%,$(h_files))
26
out_p_h_files = $(patsubst %,$(OUT_P)/%,$(h_files))
28
## Phony targets ##########################################################
30
.PHONY : default clean prof
32
## Default target #########################################################
36
## Creating the output directory structure ################################
38
dirs = $(shell $(FIND) . -type d -not -name CVS)
39
out_dirs = $(filter-out .,$(patsubst ./%,$(OUT)/%,$(dirs)))
40
out_dirs_p = $(filter-out .,$(patsubst ./%,$(OUT_P)/%,$(dirs)))
42
$(out_dirs) $(out_dirs_p) :
45
## Boot files #############################################################
47
# hs-boot files have to be in the same place as the corresponding hs file.
48
# Thus we have to copy the boot files for the generated files (Lexer and
49
# Parser) to the out directiory.
51
boot_files = $(OUT)/Agda/Syntax/Parser/Lexer.hs-boot
52
boot_files_p = $(OUT_P)/Agda/Syntax/Parser/Lexer.hs-boot
60
## Header files ###########################################################
62
$(out_h_files) : $(OUT)/%.h : %.h
65
$(out_p_h_files) : $(OUT_P)/%.h : %.h
68
## Compatibility ##########################################################
70
# If we don't have ghc-6.6 we need to supply some of the libraries.
72
ifeq ($(HAVE_GHC_6_6),No)
74
GHC_FLAGS += -i$(COMPAT_SRC_DIR)
78
## Compiling agda #########################################################
82
GHC_FLAGS += -package QuickCheck-1.0
84
$(OUT)/agda : $(out_dirs) $(out_h_files) $(all_hs_files) $(boot_files)
85
$(GHC) --make -o $@ -i$(OUT) -I. -odir $(OUT) -hidir $(OUT) $(GHC_FLAGS) Main.hs
87
$(OUT_P)/agda : $(out_dirs_p) $(out_p_h_files) $(all_hs_files_p) $(boot_files_p)
88
$(GHC) --make -o $@ -i$(OUT_P) -I. -odir $(OUT_P) -hidir $(OUT_P) $(GHC_FLAGS) Main.hs -prof -auto-all
90
## Rules for happy and alex ###############################################
93
$(ALEX) $(ALEX_FLAGS) -o $@ $<
96
$(HAPPY) $(HAPPY_FLAGS) -o $@ --info=$(OUT)/$*.happy.out $<
99
$(ALEX) $(ALEX_FLAGS) -o $@ $<
102
$(HAPPY) $(HAPPY_FLAGS) -o $@ --info=$(OUT_P)/$*.happy.out $<
104
## Tags ###################################################################
106
hTags=../hTags/dist/build/hTags/hTags
107
hTags_include=../../dist/build/autogen/cabal_macros.h
112
# create tags for VIM
113
tags : $(src_files) $(hTags) $(hTags_include)
114
$(hTags) -i$(hTags_include) -c $(src_files)
116
# create tags for emacs
117
TAGS : $(src_files) $(hTags) $(hTags_include)
118
$(hTags) -i$(hTags_include) -e $(src_files)
120
# Andreas: create tags for everything exept Auto and Compilers
121
ignore = $(patsubst ./%,%,$(shell $(FIND) ./Agda/Auto ./Agda/Compiler -name '*.hs' -o -name '*.lhs'))
122
tag_files = $(filter-out $(ignore),$(src_files))
124
mytags : $(tag_files) $(hTags) $(hTags_include)
125
$(hTags) -i$(hTags_include) -e $(tag_files)