Makefile 4.33 KB
Newer Older
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
#
# Installation Makefile for Clean
#
#
#	make (= make install):
#		install the Clean compiler
#
#	make cleanup:
#		remove all files that can be recreated
#
# This Makefile can be used with both make (Sun) and gmake (GNU make)
#

#
# START site dependent make variables
#

#
# By default the Clean compiler is installed in the current
# directory. You can change the following variables to install
# it elsewhere. 
#

INSTALL_DIR = $(CURRENTDIR)

INSTALL_BIN_DIR = $(INSTALL_DIR)/bin

INSTALL_LIB_DIR = $(INSTALL_DIR)/lib

INSTALL_MAN_DIR = $(INSTALL_DIR)/man

#
# END site dependent make variables
#


#
# The default entry
#
default: install

#
# Be quiet
#
.SILENT:
MAKEFLAGS = s

#
# The following piece of witchcraft sets the value of CURRENTDIR
# for both make and gmake.
#
CURRENTDIR = $(MAKECURRENTDIR)$(GMAKECURRENTDIR)
MAKECURRENTDIR : sh=pwd
GMAKECURRENTDIR = ${shell echo `pwd`}

#
# Install section
#
59
install: install_bin install_stdenv install_man install_doc install_ArgEnv install_Generics install_StdLib install_Directory install_MersenneTwister install_TCPIP install_Platform $(PATCHES)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
	$(PATCH_BIN) $(INSTALL_CLM) CLEANLIB $(INSTALL_EXE_DIR)
	
io: install
cleanup: cleanup_stdenv

#
# Commands section
#
CLM = \
'CLEANLIB=$(CURRENTDIR)/exe;export CLEANLIB;CLEANPATH=$(CURRENTDIR)/StdEnv;export CLEANPATH;$(CURRENTDIR)/bin/clm'
CLMFLAGS = -nw
HTOCLEAN = $(CURRENTDIR)/bin/htoclean
FCLC = $(CURRENTDIR)/bin/fclc

PATCH_BIN = $(CURRENTDIR)/bin/patch_bin

#
# Binaries
#
BIN_FILES = clm htoclean BatchBuild
EXE_FILES = cocl cg

INSTALL_BIN_FILES = $(BIN_FILES:%=$(INSTALL_BIN_DIR)/%)
INSTALL_CLM = $(INSTALL_BIN_DIR)/clm

INSTALL_EXE_DIR = $(INSTALL_LIB_DIR)/exe
INSTALL_EXE_FILES = $(EXE_FILES:%=$(INSTALL_EXE_DIR)/%)

INSTALL_TEMP_DIR = $(INSTALL_DIR)/Temp

install_bin : $(INSTALL_BIN_DIR) $(INSTALL_BIN_FILES) \
				$(INSTALL_EXE_DIR) $(INSTALL_EXE_FILES) $(INSTALL_TEMP_DIR)

DEL = %

$(INSTALL_BIN_DIR):
	mkdir -m 755 -p $@

$(INSTALL_BIN_DIR)/% : bin/%
	cp $< $@
	chmod 711 $@

$(INSTALL_EXE_DIR):
	mkdir -m 755 -p $@

$(INSTALL_EXE_DIR)/% : exe/%
	cp $< $@
	chmod 711 $@

$(INSTALL_TEMP_DIR):
	mkdir -m 755 -p $@

#	cp CleanIDEConfig $@
#	chmod 644 $@

#
# Clean Standard Environment
#
INSTALL_STDENV_DIR = $(INSTALL_LIB_DIR)/StdEnv

#	$(MAKE) install \
#		INSTALL_STDENV_DIR=$(INSTALL_STDENV_DIR) \
#		CLM=$(CLM) \
#		CLMFLAGS=$(CLMFLAGS)

install_stdenv :
	cd StdEnv; \
	export CLEANLIB=$(CURRENTDIR)/exe; \
	export CLEANPATH=$(CURRENTDIR)/StdEnv; \
	export CLMP=$(CURRENTDIR)/bin/clm; \
	export INSTALL_STDENV_DIR=$(INSTALL_STDENV_DIR); \
	export CLMFLAGS=$(CLMFLAGS); \
	./install.sh; \
	$(PATCH_BIN) $(INSTALL_CLM) CLEANPATH $(INSTALL_STDENV_DIR); \
	$(PATCH_BIN) $(INSTALL_CLM) CLEANILIB $(INSTALL_LIB_DIR);

cleanup_stdenv :
	cd StdEnv; $(MAKE) cleanup

#
# Clean man pages
#

MAN_FILES = man1/clm.1

INSTALL_MAN_FILES = $(MAN_FILES:%=$(INSTALL_MAN_DIR)/%)

install_man : $(INSTALL_MAN_DIR)/man1 $(INSTALL_MAN_FILES)

$(INSTALL_MAN_DIR)/man1 :
	mkdir -p $@

$(INSTALL_MAN_DIR)/man1/% : man/man1/%
	cp $< $@
	chmod 644 $@

$(INSTALL_LIB_DIR)/doc :
	mkdir -p $@

install_doc : $(INSTALL_LIB_DIR)/doc
	cp -r doc/* $(INSTALL_LIB_DIR)/doc

$(INSTALL_LIB_DIR)/ArgEnv :
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_ArgEnv : $(INSTALL_LIB_DIR)/ArgEnv
	( cd data/ArgEnv ; make ArgEnvC.o )
	cp -r data/ArgEnv/* $(INSTALL_LIB_DIR)/ArgEnv

$(INSTALL_LIB_DIR)/Generics :
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_Generics : $(INSTALL_LIB_DIR)/Generics
	cp -r data/Generics/* $(INSTALL_LIB_DIR)/Generics

$(INSTALL_LIB_DIR)/StdLib :
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_StdLib : $(INSTALL_LIB_DIR)/StdLib
	cp -r data/StdLib/* $(INSTALL_LIB_DIR)/StdLib

$(INSTALL_LIB_DIR)/Directory:
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_Directory: $(INSTALL_LIB_DIR)/Directory
	cp -r data/Directory/* $(INSTALL_LIB_DIR)/Directory

$(INSTALL_LIB_DIR)/MersenneTwister:
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_MersenneTwister: $(INSTALL_LIB_DIR)/MersenneTwister
	cp -r data/MersenneTwister/* $(INSTALL_LIB_DIR)/MersenneTwister

$(INSTALL_LIB_DIR)/TCPIP:
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_TCPIP: $(INSTALL_LIB_DIR)/TCPIP
	cp -r data/TCPIP/* $(INSTALL_LIB_DIR)/TCPIP

$(INSTALL_LIB_DIR)/Platform:
	mkdir -p $@
	mkdir -p $@/"Clean System Files"

install_Platform: $(INSTALL_LIB_DIR)/Platform
	cp -R data/Platform/* $(INSTALL_LIB_DIR)/Platform