1
# Compiler Toolkit: makefile for the system dependent modules
3
# Author : Manuel M T Chakravarty
4
# Created: 24 October 1997
6
# Version $Revision: 1.18 $ from $Date: 2003/10/19 10:45:27 $
8
# Copyright (c) [1997..2003] Manuel M T Chakravarty
10
# This file is free software; you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation; either version 2 of the License, or
13
# (at your option) any later version.
15
# This file is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
20
# = DOCU =====================================================================
23
# ***************************************
24
# !!! This makefile requires GNU make !!!
25
# ***************************************
27
# we need the config info to determine which sources we have to compile
29
include ../../mk/config.mk
31
# info for this part: its package, name, sources and objects files (must be
32
# before the include due to conditionals etc in `common.mk')
37
SRCS = SysDep.hs SysDepPosix.hs
39
# extra sources for nhc
41
ifeq ($(SYS),$(findstring $(SYS),nhc1))
45
OBJS = $(patsubst %.hs,%.o,$(SRCS))
47
include ../../mk/common.mk
49
# In case we use a GHC4, GHC5, or GHC6 system, we need some extra options for
52
# * we currently need `-fvia-C', as the native code generator doesn't grok
53
# some of the non-standard primitives
55
ifeq ($(SYS),$(findstring $(SYS),ghc4 ghc5 ghc6))
56
EXTRAHCFLAGS= -fglasgow-exts -fvia-C
59
# extra dependencies for nhc
61
ifeq ($(SYS),$(findstring $(SYS),nhc1))
66
# make all object files
75
# Use appropriate system dependent modules
76
# ========================================
78
.PHONY: config testconfig
80
# name of the Haskell module containing the system dependend code for
81
# system $(SYS) -- "SysDep" ++ $(SYS) ++ ".hs"
83
# FIXME: Has anybody a good idea how to convert a string to all upper here
85
SYSUPPER = $(subst nhc,NHC,$(subst ghc,GHC,$(SYS)))
86
SYSDEPHS = $(addsuffix .hs,$(addprefix SysDep,$(SYSUPPER)))
87
AVAIL_SYSDEPHS= $(wildcard SysDep*.hs)
89
# if the code for the requested system is present, enable it; otherwise, error
91
# * in case of success, we also invoke a `config' target in the `syntax' part,
92
# as we have to exlude some module for some systems
94
# * Then, we check for supports of HSLibs' posix package
96
# * SysDepGHC5.hs is an alias of SysDepGHC4.hs
99
@$(RM) SysDepGHC5.hs SysDepGHC6.hs
100
@$(LN) -s SysDepGHC4.hs SysDepGHC5.hs
101
@$(LN) -s SysDepGHC4.hs SysDepGHC6.hs
102
ifeq ($(SYSDEPHS),$(findstring $(SYSDEPHS),$(AVAIL_SYSDEPHS) SysDepGHC5.hs SysDepGHC6.hs))
104
$(LN) -s $(SYSDEPHS) SysDep.hs
105
@echo "*** Configured for compilation system $(SYS)."
106
$(MAKE) -C ../syntax $(MFLAGS) $@
108
@echo "$(SYSDEPHS) in $(AVAIL_SYSDEPHS) SysDepGHC5.hs SysDepGHC6.hs"
109
@echo "*** Unsupported Haskell compiler \`$(SYS)' specified! "
113
# Posix (and hence, `runPiped') support disabled, as `runPiped' (1) isn't
114
# really used at the moment, (2) should be rewritten anyway, and (3) breaks
115
# with GHC 6.3 as the signature of `forkProcess' changed.
116
#ifeq (posix,$(findstring posix,$(SYSFEATURES)))
117
# $(LN) -s SysDepPosixAVAIL.hs SysDepPosix.hs
118
# @echo "*** Configured for use of HSLibs posix package."
120
$(LN) -s SysDepPosixUNAVAIL.hs SysDepPosix.hs
121
# @echo "*** Configured WITHOUT HSLibs posix package."
127
@if [ ! -f SysDep.hs ]; then \
128
echo "*** Configure with \`make config' first! "; \
131
@echo "*** Compiling with system specifier $(SYS)."
137
.PHONY: clean cleanhi
141
-$(RM) SysDepGHC5.hs SysDepGHC6.hs SysDep.hs SysDepPosix.hs