aboutsummaryrefslogtreecommitdiff
path: root/sol-GNUmakefile
blob: d359c1b30a147b2dd3c80fecae7625222102e0b6 (plain)
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
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
212
213
214
215
216
217
218
219
220
221
222
#!/usr/latest/bin/make -f
#
# Makefile used to three-stage build a tree of source code, usually devo.  
#

# Every invocation of this Makefile needs to have a variable set (host), 
# which is the named used for ./configure, and also the prefix for the
# various files and directories used in a three stage.
#

ifndef host
error: 
	@echo
	@echo
	@echo You must set the variable \"host\" to use this Makefile
	@echo
	@echo
	@exit 1
else

# 
# from here to very near the end of the file is the real guts of this 
# Makefile, and it is not seen if the variable 'host' is not set 
# 

TREE 		:= progressive
ROOTING 	:= /opt/cygnus-sol2-1.0
CVS_MODULE 	:= progressive-solaris
TAG_DATE 	:= 920615
RELEASE_TAG 	:= $(CVS_MODULE)-$(TAG_DATE)
release_root 	:= $(ROOTING)

TIME 	:= time
NICE 	:= nice -17
MF   	:= -w
GNUC 	:= gcc -g

SHELL 	:= /bin/sh

INSTDIR  := $(shell pwd)/$(host)
PREFIXES := prefix=$(ROOTING)

ifdef target
arch=$(host)=$(target)
endif

.PHONY: all
all:	do1 do2 do3

.PHONY: configuration
configuration: $(TREE) $(host)-stamp-stage1-configured

.PHONY: comparison
comparison:
	for i in `cd $(host)-objdir.3 ; find . -name \*.o -print` ; do \
		cmp $(host)-objdir.2/$$i $(host)-objdir.3/$$i ; \
	done

.PHONY: clean
clean:
	rm -rf $(host)-$(TREE)-holes $(host)-objdir $(host)-objdir.[123] $(host)-stamp-stage[123]* $(host)-stamp-holes *~

.PHONY: very
very:
	rm -rf $(TREE)

$(TREE):
	$(TIME) cvs co $(CVS_TAG) $(CVS_MODULE)

.PHONY: do1
do1:	$(host)-$(TREE)-holes $(host)-stamp-stage1

$(host)-stamp-stage1: $(host)-objdir.1
	touch $(host)-stamp-stage1

$(host)-objdir.1: $(TREE) $(host)-stamp-stage1-configured
	(cd $(host)-objdir ; $(TIME) make $(MF) all info host=$(host))
	@echo CONFIGURE: make all completed for $(host)
	(cd $(host)-objdir ; $(TIME) make $(MF) install install-info host=$(host))
	@echo CONFIGURE: make install-all completed for $(host)
	mv $(host)-objdir $(host)-objdir.1

$(host)-stamp-stage1-configured:
	[ -d $(host)-objdir ] || mkdir $(host)-objdir
	(cd $(host)-objdir ; \
		$(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
			-prefix=$(ROOTING))
	touch $@

.PHONY: do2
do2:	$(host)-$(TREE)-holes $(host)-stamp-stage2

$(host)-stamp-stage2: $(host)-objdir.2
	PATH=$(release_root)/bin:`pwd`/$(host)-$(TREE)-holes ; \
		export PATH ; \
		echo $$PATH ; \
		SHELL=sh ; export SHELL ; \
		$(TIME) make $(host)-objdir.2 host=$(host)
	touch $(host)-stamp-stage2

$(host)-objdir.2: $(TREE) $(host)-stamp-stage2-configured
	[ -d $(host)-objdir ] || mkdir $(host)-objdir
	(cd $(host)-objdir ; $(TIME) make $(MF) all info  "CC=$(GNUC)" host=$(host))
	(cd $(host)-objdir ; $(TIME) make $(MF) $(PREFIXES) install install-info "CC=$(GNUC)" host=$(host))
	mv $(host)-objdir $(host)-objdir.2

$(host)-stamp-stage2-configured:
	[ -d $(host)-objdir ] || mkdir $(host)-objdir
	(cd $(host)-objdir ; \
		$(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
			-prefix=$(ROOTING))
	touch $@

.PHONY: do3
do3:	$(host)-$(TREE)-holes $(host)-stamp-stage3

$(host)-stamp-stage3: $(host)-objdir.3
	PATH=$(release_root)/bin:`pwd`/$(host)-$(TREE)-holes ; \
		export PATH ; \
		SHELL=sh ; export SHELL ; \
		$(TIME) make $(host)-objdir.3 host=$(host)
	touch $(host)-stamp-stage3

$(host)-objdir.3: $(TREE) $(host)-stamp-stage3-configured
	[ -d $(host)-objdir ] || mkdir $(host)-objdir
	(cd $(host)-objdir ; $(TIME) make $(MF) all info "CC=$(GNUC)" host=$(host))
	(cd $(host)-objdir ; $(TIME) make $(MF) install-no-fixedincludes install-info "CC=$(GNUC)"  host=$(host))
	mv $(host)-objdir $(host)-objdir.3

$(host)-stamp-stage3-configured:
	[ -d $(host)-objdir ] || mkdir $(host)-objdir
	(cd $(host)-objdir ; \
		$(TIME) ../$(TREE)/configure $(host) -v -srcdir=../$(TREE) \
			-prefix=$(ROOTING))
	touch $@

HOLES := [ \
	ar \
	as \
	awk \
	basename \
	cat \
	cc \
	chmod \
	cmp \
	cp \
	date \
	echo \
	egrep \
	ex \
	expr \
	find \
	grep \
	hostname \
	install \
	ld \
	lex \
	ln \
	ls \
	mkdir \
	mv \
	pwd \
	ranlib \
	rm \
	rmdir \
	sed \
	sh \
	sort \
	time \
	touch \
	tr \
	true \
	whoami

PARTIAL_HOLES := \
	gcc \
	make


$(host)-$(TREE)-holes: $(host)-stamp-holes

$(host)-stamp-holes:
	-rm -rf $(host)-$(TREE)-holes
	-mkdir $(host)-$(TREE)-holes
	for i in $(HOLES) ; do \
		if [ -x $(host)-$(TREE)-holes/$$i ] ; then \
			echo "$$i already present" ; \
                else if [ -x /bin/$$i ] ; then \
			cp /bin/$$i $(host)-$(TREE)-holes ; \
                        echo $$i from /bin ; \
		else if [ -x /usr/bin/$$i ] ; then \
			cp /usr/bin/$$i $(host)-$(TREE)-holes ; \
                        echo $$i from /usr/bin ; \
		else if [ -x /usr/ccs/bin/$$i ] ; then \
			cp /usr/ccs/bin/$$i $(host)-$(TREE)-holes ; \
                        echo $$i from /usr/ccs/bin ; \
		else if [ -x /usr/unsupported/bin/$$i ] ; then \
			cp /usr/unsupported/bin/$$i $(host)-$(TREE)-holes ; \
                        echo $$i from /usr/unsupported/bin ; \
		else \
			echo $$i is NOT found ; \
		fi; fi ; fi ; fi ; fi ; true ; \
	done
	for i in $(PARTIAL_HOLES) ; do \
	        if [ -x /usr/latest/bin/$$i ] ; then \
	              cp /usr/latest/bin/$$i $(host)-$(TREE)-holes ; \
	                echo $$i from /usr/latest/bin ; \
	         else if [ -x /usr/unsupported/bin/$$i ] ; then \
	              cp /usr/unsupported/bin/$$i $(host)-$(TREE)-holes ; \
	                echo $$i from /usr/unsupported/bin ; \
	        fi; fi; \
	done
	touch $(host)-stamp-holes

force:

endif # host

### Local Variables:
### fill-column: 131
### End: