source: trunk/Makefile@ 385

Last change on this file since 385 was 363, checked in by bird, 22 years ago

More hacking.

  • Property cvs2svn:cvs-rev set to 1.34
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 34.3 KB
Line 
1# $Id: Makefile 363 2003-07-11 15:40:31Z bird $
2#
3# Top level makefile.
4#
5# InnoTek Systemberatung GmbHconfidential
6#
7# Copyright (c) 2003 InnoTek Systemberatung GmbH
8# Author: knut st. osmundsen <bird@anduin.net>
9#
10# All Rights Reserved
11#
12
13
14###############################################################################
15## Global Variables
16## (D = no drive)
17###############################################################################
18PWD := $(shell pwd)
19PWDD := $(shell pwd|sed 's/^[a-zA-Z]://')
20MAKEFILE = $(PWD)/Makefile
21
22ifndef BUILD_MODE
23export BUILD_MODE=DEBUG
24endif
25
26ifndef PATH_TOP
27export PATH_TOP := $(PWD)
28endif
29ifndef PATH_TOPD
30export PATH_TOPD := $(PWDD)
31endif
32
33
34export PATH_BIN = $(PATH_TOP)/bin/$(BUILD_PLATFORM)/$(BUILD_MODE)
35export PATH_BIND = $(PATH_TOPD)/bin/$(BUILD_PLATFORM)/$(BUILD_MODE)
36export PATH_OBJ = $(PATH_TOP)/obj/$(BUILD_PLATFORM)/$(BUILD_MODE)
37export PATH_OBJD = $(PATH_TOPD)/obj/$(BUILD_PLATFORM)/$(BUILD_MODE)
38export PATH_BUILTTOOLS = $(PATH_OBJ)/builttools
39export PATH_BUILTTOOLSD= $(PATH_OBJD)/builttools
40PATH_BUILTTOOLS_TMP = $(PATH_OBJ)/builttools.tmp
41PATH_BUILTTOOLS_TMPD = $(PATH_OBJD)/builttools.tmp
42
43# Debug info or not (when ever we feel like passing down such options).
44# Several ways to do this it seems.
45ifeq "$(BUILD_MODE)" "RELEASE"
46BUILD_DEBUGINFO = -s
47BUILD_ENABLE_SYMBOLS = --disable-symbols
48else
49BUILD_DEBUGINFO = -g
50BUILD_ENABLE_SYMBOLS = --enable-symbols
51endif
52
53
54# Version and CVS defines
55export GCC_VERSION ?= 3.2.2
56export GCC_VERSION_SHORT ?= 3022
57export GCC_CVS_VENDOR ?= GNU
58export GCC_CVS_REL ?= GCC_3-2-2
59export BINUTILS_VERSION ?= 2.11.2
60export BINUTILS_VERSION_SHORT ?= 2112
61export BINUTILS_CVS_VENDOR ?= GNU
62export BINUTILS_CVS_REL ?= BINUTILS_2-11-2
63export EMX_VERSION ?= 0.9d-fix04
64export EMX_VERSION_SHORT ?= 9d04
65export EMX_CVS_VENDOR ?= EMX
66export EMX_CVS_REL ?= EMX_0-9D-FIX04
67
68# innotek version and timestamp
69export INNOTEK_VERSION ?= (Innotek Build $(shell date '+%Y-%m-%d %H:%M'))
70
71
72#
73# For builds on Linux Host builds we do the environment setup here.
74# This is essentially a mimicking of what we do on OS/2.
75#
76ifndef BUILD_PLATFORM
77ifeq "$(shell uname -s)" "Linux"
78export BUILD_PLATFORM ?= LINUX
79export BUILD_PROJECT ?= GCCOS2
80export SH ?= /bin/sh
81export ASH ?= /bin/ash
82export BASH ?= /bin/bash
83export AWK ?= /bin/gawk
84export GAWK ?= /bin/gawk
85export CONFIG_SHELL ?= $(SH)
86export MAKESHELL ?= $(SH)
87export PATH_EMX ?= /usr
88export PATH_EMXPGCC ?= /usr
89export TMP ?= /tmp
90export TMPDIR ?= /tmp
91endif
92endif
93
94
95
96# Misc Helpers
97ALL_PREFIX = $(PATH_BIND)/$(GCC_VERSION)/usr
98TOOL_CVS_DIFF_TREE = -cvs diff -R -N -w -u -r
99
100
101
102
103
104###############################################################################
105###############################################################################
106###############################################################################
107###############################################################################
108#
109# M a i n R u l e z
110#
111###############################################################################
112###############################################################################
113###############################################################################
114###############################################################################
115all:
116 mkdir -p $(PATH_OBJ)
117 $(MAKE) -C . all-logged 2>&1 | $(UNIXROOT)/usr/bin/tee $(PATH_OBJ)/build-`date +"%Y%m%d-%H%M%S"`.log
118
119all-logged: \
120 all-banner-start \
121 all-env \
122 all-sanity \
123 all-preload \
124 all-versionstamps \
125 all-symlinks \
126 \
127 all-stage1 \
128 all-stage2 \
129 \
130 all-install \
131 \
132 all-symlinks-unlink
133 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
134 @echo "+ Make Ended Successfully: $(shell date)"
135 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
136
137#
138# banners
139#
140
141all-banner-start:
142 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
143 @echo "+ Make started: $(shell date)"
144 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
145
146all-banner-stage1:
147 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
148 @echo "+ Stage 1 - starting: $(shell date)"
149 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
150
151all-banner-stage2:
152 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
153 @echo "+ Stage 2 - starting: $(shell date)"
154 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
155
156all-banner-builttools-initial:
157 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
158 @echo "+ Initializing builttools tree"
159 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
160
161all-banner-builttools-stage2:
162 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
163 @echo "+ Copying stage2 builttools"
164 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
165
166all-banner-install:
167 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
168 @echo "+ Install - starting: $(shell date)"
169 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
170
171all-banner-install-done:
172 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
173 @echo "+ Install - done: $(shell date)"
174 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
175
176
177#
178# Sanity and environment dumps - to make it easier to figure out make bugs.
179#
180
181all-env:
182 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
183 @echo "Variables:"
184 @echo " PWD = $(PWD)"
185 @echo " PWDD = $(PWDD)"
186 @echo " PATH_TOP = $(PATH_TOP)"
187 @echo " PATH_TOPD = $(PATH_TOPD)"
188 @echo " PATH_OBJ = $(PATH_OBJ)"
189 @echo " PATH_OBJD = $(PATH_OBJD)"
190 @echo " PATH_BIN = $(PATH_BIN)"
191 @echo " PATH_BIND = $(PATH_BIND)"
192 @echo " ALL_PREFIX = $(ALL_PREFIX)"
193 @echo " PATH_EMXPGCC = $(PATH_EMXPGCC)"
194 @echo " PATH_EMX = $(PATH_EMX)"
195 @echo " BUILD_MODE = $(BUILD_MODE)"
196 @echo " BUILD_PLATFORM = $(BUILD_PLATFORM)"
197 @echo " BUILD_PROJECT = $(BUILD_PROJECT)"
198 @echo " GCC_VERSION = $(GCC_VERSION)"
199 @echo " GCC_VERSION_SHORT = $(GCC_VERSION_SHORT)"
200 @echo " GCC_CVS_VENDOR = $(GCC_CVS_VENDOR)"
201 @echo " GCC_CVS_REL = $(GCC_CVS_REL)"
202 @echo " BINUTILS_VERSION = $(BINUTILS_VERSION)"
203 @echo " BINUTILS_VERSION_SHORT = $(BINUTILS_VERSION_SHORT)"
204 @echo " BINUTILS_CVS_VENDOR = $(BINUTILS_CVS_VENDOR)"
205 @echo " BINUTILS_CVS_REL = $(BINUTILS_CVS_REL)"
206 @echo " EMX_VERSION = $(EMX_VERSION)"
207 @echo " EMX_VERSION_SHORT = $(EMX_VERSION_SHORT)"
208 @echo " EMX_CVS_VENDOR = $(EMX_CVS_VENDOR)"
209 @echo " EMX_CVS_REL = $(EMX_CVS_REL)"
210 @echo " MAKEFILE = $(MAKEFILE)"
211 @echo " UNIXROOT = $(UNIXROOT)"
212 @echo " AC_PREFIX = $(AC_PREFIX)"
213 @echo " AC_MACRODIR = $(AC_MACRODIR)"
214 @echo " HOSTNAME = $(HOSTNAME)"
215 @echo " USER = $(USER)"
216 @echo " LOGNAME = $(LOGNAME)"
217 @echo " TMP = $(TMP)"
218 @echo " TMPDIR = $(TMPDIR)"
219 @echo " USER = $(USER)"
220 @echo " AWK = $(AWK)"
221 @echo " GAWK = $(GAWK)"
222 @echo " SH = $(SH)"
223 @echo " ASH = $(ASH)"
224 @echo " BASH = $(BASH)"
225 @echo " CONFIG_SHELL = $(CONFIG_SHELL)"
226 @echo " MAKESHELL = $(MAKESHELL)"
227 @echo " EMXSHELL = $(EMXSHELL)"
228 @echo " SHELL = $(SHELL)"
229 @echo " MAKE = $(MAKE)"
230 @echo " PATH = $(PATH)"
231 @echo " C_INCLUDE_PATH = $(C_INCLUDE_PATH)"
232 @echo " CPLUS_INCLUDE_PATH = $(CPLUS_INCLUDE_PATH)"
233 @echo " OBJC_INCLUDE_PATH = $(OBJC_INCLUDE_PATH)"
234 @echo " LIBRARY_PATH = $(LIBRARY_PATH)"
235 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
236 @echo "Content of PATH_OBJ:"
237 -ls -la $(PATH_OBJ)/
238 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
239 @echo "Content of PATH_BIN:"
240 -ls -la $(PATH_BIN)/
241 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
242
243
244all-sanity:
245 @echo -n "Checking build environment sanity... "
246 @if [ "x$(BUILD_PROJECT)" != "xGCCOS2" ]; then \
247 echo ""; echo "Error: BUILD_PROJECT is wrong or isn't defined!"; \
248 exit 8; \
249 fi
250 @if [ "x$(BUILD_PLATFORM)" != "xOS2" -a "x$(BUILD_PLATFORM)" != "xLINUX" ]; then \
251 echo ""; echo "Error: BUILD_PLATFORM is wrong or isn't defined!"; \
252 exit 8; \
253 fi
254 @if [ "x$(BUILD_PLATFORM)" = "xOS2" -a "x$(UNIXROOT)" = "x" ]; then \
255 echo ""; echo "Error: UNIXROOT isn't defined!"; \
256 exit 8; \
257 fi
258 @if [ "x$(BUILD_PLATFORM)" != "xOS2" -a "x$(UNIXROOT)" != "x" ]; then \
259 echo ""; echo "Error: UNIXROOT is defined!"; \
260 exit 8; \
261 fi
262ifeq "$(BUILD_PLATFORM)" "OS2"
263 @if gcc --version | grep -qe ".*[3]\.[2-9]\.[0-9]"; then \
264 true; \
265 else \
266 echo ""; echo "Warning: GCC v3.2.x or higher is recommended!"; \
267 fi
268 @if ar --version | grep -qe ".*2\.11\.[2-9]" -e ".*[2]\.1[2-9]\.[0-9]*"; then \
269 true; \
270 else \
271 echo ""; echo "Warning: AR v2.11.2 or higher is recommended!"; \
272 fi
273endif
274 @echo "ok"
275
276
277#
278# Preload tools we commonly use this speeds up stuff.
279#
280PRELOADED_TOOLS = bin/sh.exe bin/echo.exe bin/true.exe usr/bin/test.exe usr/bin/expr.exe \
281 usr/bin/gawk.exe usr/bin/sed.exe bin/rm.exe bin/cat.exe bin/cp.exe
282
283all-preload:
284 @echo "Preloading tools:"
285ifeq "$(BUILD_PLATFORM)" "OS2"
286 @for tool in $(PRELOADED_TOOLS); do \
287 echo -n " $$tool"; \
288 emxload -e $(UNIXROOT)/$$tool; \
289 done
290 emxload -e gcc.exe g++.exe ld.exe cc1.exe as.exe cc1plus.exe ar.exe cpp0.exe ld.exe
291endif
292 @echo ""
293
294all-preload-unload-obj:
295ifeq "$(BUILD_PLATFORM)" "OS2"
296 -for prog in `emxload -l | sed -e 's|\\\|\/|g' -e 's@.*³[[:blank:]]*@@' | grep -i '$(PATH_OBJD)'`; \
297 do \
298 echo $$prog; \
299 emxload -u $$prog; \
300 done
301endif
302
303
304#
305# Version stamping/branding.
306# Update various version strings which are printed from the tools to tell
307# the build date and that's our built. This helps us tell releases apart.
308#
309# IMPORTANT! Take care not to commit the changed files
310# (TODO! Try make these changes to non-cvs backed files. (long-term-goal))
311.PHONY: all-versionstamps
312all-versionstamps: $(PATH_OBJ)/.ts.versionstamped
313$(PATH_OBJ)/.ts.versionstamped:
314 echo '#define INNOTEK_VERSION "$(INNOTEK_VERSION)"' > include/innotekversion.h
315 $(MAKE) -f $(MAKEFILE) "INNOTEK_VERSION=$(INNOTEK_VERSION)" gcc-versionstamps binutils-versionstamps emx-versionstamps
316 mkdir -p $(@D)
317 touch $@
318
319
320#
321# Stages
322# A rebuild with the new toolsuite is usually required when there is ABI
323# changes and other vital changes done to the tools.
324#
325
326all-stage1: $(PATH_OBJ)/.all-stage1
327$(PATH_OBJ)/.all-stage1:
328 $(MAKE) -f $(MAKEFILE) all-stage1-it
329 echo "$(@F)" > $(PATH_OBJ)/.last-stage
330 touch $@
331 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
332 @echo "+ Stage 1 - done: $(shell date)"
333 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
334
335all-stage1-it: \
336 all-banner-stage1 \
337 all-builttools-initial \
338 all-emx \
339 all-binutils \
340 all-gcc
341
342
343all-stage2: $(PATH_OBJ)/.all-stage2
344$(PATH_OBJ)/.all-stage2: \
345 $(PATH_OBJ)/.all-stage2.save-stage1
346 $(MAKE) -f $(MAKEFILE) all-stage2-it
347 echo "$(@F)" > $(PATH_OBJ)/.last-stage
348 touch $@
349 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
350 @echo "+ Stage 2 - done: $(shell date)"
351 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
352
353$(PATH_OBJ)/.all-stage2.save-stage1:
354 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
355 @echo "+ Saving Stage 1 - Starting: $(shell date)"
356 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
357 $(MAKE) -f $(MAKEFILE) all-preload-unload-obj
358 $(MAKE) -f $(MAKEFILE) all-builttools-stage2
359 rm -Rf $(PATH_OBJ)/stage1
360 mkdir -p $(PATH_OBJ)/stage1
361 if [ -d $(PATH_OBJ)/gcc ] ; then mv $(PATH_OBJ)/gcc $(PATH_OBJ)/stage1/gcc; fi
362 if [ -d $(PATH_OBJ)/emx ] ; then mv $(PATH_OBJ)/emx $(PATH_OBJ)/stage1/emx; fi
363 if [ -d $(PATH_TOP)/src/emx/out ] ; then mv $(PATH_TOP)/src/emx/out $(PATH_OBJ)/stage1/emx_out; fi
364 $(MAKE) -f $(MAKEFILE) all-preload
365 touch $@
366 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
367 @echo "+ Saving Stage 1 - done: $(shell date)"
368 @echo "+++++++++++++++++++++++++++++++++++++++++++++++++++"
369
370all-stage2-it: \
371 all-banner-stage2 \
372 all-emx \
373 all-binutils \
374 all-gcc
375
376
377#
378# Install to bin tree makeing it ready for packing.
379#
380all-install: \
381 all-banner-install \
382 gcc-install \
383 emx-install \
384 all-banner-install-done \
385
386
387#
388# Generate all the diffs we have to supply.
389#
390all-diff: \
391 gcc-diff \
392 binutils-diff \
393 emx-diff \
394
395
396
397
398
399
400###############################################################################
401###############################################################################
402###############################################################################
403#
404# B u i l t T o o l s
405#
406###############################################################################
407###############################################################################
408###############################################################################
409.PHONY: all-builttools-initial all-builttools-dirs all-builttools-clean all-builttools-stage2
410
411all-builttools-initial: \
412 all-banner-builttools-initial \
413 all-builttools-clean \
414 all-builttools-dirs \
415 $(PATH_BUILTTOOLS)/bin/dllar.cmd \
416
417all-builttools-clean: \
418 all-preload-unload-obj
419 rm -Rf $(PATH_BUILTTOOLS)
420
421all-builttools-dirs:
422 mkdir -p $(PATH_BUILTTOOLS)/bin $(PATH_BUILTTOOLS)/lib $(PATH_BUILTTOOLS)/include
423
424$(PATH_BUILTTOOLS)/bin/dllar.cmd $(PATH_BUILTTOOLS_TMP)/bin/dllar.cmd: $(PATH_TOP)/src/misc/dllar.cmd
425 cp $< $@
426
427all-builttools-stage2: \
428 all-banner-builttools-stage2 \
429 gcc-builttools-stage2 \
430 emx-builttools-stage2 \
431 all-builttools-stage2-libs \
432 $(PATH_BUILTTOOLS_TMP)/bin/dllar.cmd \
433 all-builttools-clean
434 mv -f $(PATH_BUILTTOOLS_TMP) $(PATH_BUILTTOOLS)
435
436all-builttools-stage2-libs:
437 -for aoutlib in `find $(PATH_BUILTTOOLS_TMP) -name "*.a" | sed -e 's/\.a$$//' `; \
438 do \
439 if [ ! -f $(aoutlib).lib ]; then \
440 echo " $${aoutlib}"; \
441 $(PATH_BUILTTOOLS_TMP)/bin/emxomf.exe $${aoutlib}.a; \
442 fi;\
443 done
444
445
446###############################################################################
447###############################################################################
448###############################################################################
449#
450# S y m l i n k s
451#
452#
453# We use symlinking of binutils stuff into the gcc tree so we can
454# build everything in one go and take advantage of the gcc
455# makesystem which will use the binutils we built when doing the
456# gcc libraries and such.
457#
458# On OS/2 symlinks doesn't exist so, we'll copy the source trees.
459# Copy because this will for directories work ok with cvs, moving
460# directories would cause 'cvs update -d' to refetch stuff.
461#
462# IMPORTANT! Take care, the 'symlined' stuff will be removed at the
463# end of the build. Remeber to do all-symlinks-unlink before a fresh
464# build is started as the duplicated binutils things doesn't get
465# updated by cvs.
466#
467#
468#w##############################################################################
469###############################################################################
470###############################################################################
471all-symlinks: \
472 all-symlinks-binutils
473
474all-symlinks-unlink: \
475 all-symlinks-unlink-binutils
476
477
478ifeq "$(BUILD_PLATFORM)" "OS2"
479TOOL_SYMLINK_FILE = cp -p
480TOOL_SYMLINK_DIR = cp -pRf
481TOOL_SYMLINK_MKDIR = mkdir
482TOOL_UNSYMLINK_DIR = rm -Rf
483else
484TOOL_SYMLINK_FILE = ln -s
485TOOL_SYMLINK_DIR = ln -s
486TOOL_SYMLINK_MKDIR = true
487TOOL_UNSYMLINK_DIR = rm
488endif
489
490# ld is broken, so don't use it!
491# ld \
492
493SYMLINKS_BINUTILS_TO_GCC_DIRS = \
494bfd \
495binutils \
496etc \
497gas \
498gprof \
499intl \
500opcodes \
501texinfo \
502include/aout \
503include/coff \
504include/elf \
505include/nlm \
506include/opcode \
507include/regs \
508
509SYMLINKS_BINUTILS_TO_GCC_FILES = \
510include/alloca-conf.h \
511include/ansidecl.h \
512include/bfdlink.h \
513include/bin-bugs.h \
514include/bout.h \
515include/callback.h \
516include/ChangeLog \
517include/COPYING \
518include/demangle.h \
519include/dis-asm.h \
520include/dyn-string.h \
521include/filenames.h \
522include/floatformat.h \
523include/fnmatch.h \
524include/fopen-bin.h \
525include/fopen-same.h \
526include/fopen-vms.h \
527include/gdbm.h \
528include/getopt.h \
529include/hashtab.h \
530include/hp-symtab.h \
531include/ieee.h \
532include/libiberty.h \
533include/MAINTAINERS \
534include/md5.h \
535include/oasys.h \
536include/objalloc.h \
537include/obstack.h \
538include/os9k.h \
539include/partition.h \
540include/progress.h \
541include/remote-sim.h \
542include/safe-ctype.h \
543include/sim-d10v.h \
544include/sort.h \
545include/splay-tree.h \
546include/symcat.h \
547
548# Symlink binutils stuff to gcc.
549# Note the test should've been "! -e", but that doesn' work in ash... :/
550all-symlinks-binutils:
551 for file in $(SYMLINKS_BINUTILS_TO_GCC_FILES); do \
552 if [ ! -f "$(PATH_TOP)/src/gcc/$$file" ]; then \
553 $(TOOL_SYMLINK_FILE) $(PATH_TOP)/src/binutils/$$file $(PATH_TOP)/src/gcc/$$file && \
554 touch $(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'`; \
555 fi ; \
556 done
557 for dir in $(SYMLINKS_BINUTILS_TO_GCC_DIRS) ; do \
558 if [ ! -d "$(PATH_TOP)/src/gcc/$$dir" ] ; then \
559 $(TOOL_SYMLINK_MKDIR) $(PATH_TOP)/src/gcc/$$dir && \
560 touch $(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'` && \
561 $(TOOL_SYMLINK_DIR) $(PATH_TOP)/src/binutils/$$dir $(PATH_TOP)/src/gcc/`echo $${dir}| sed -e '/\//!d' -e 's@\([a-zA-z0-9]*\)/.*@\1/@'` ; \
562 fi ; \
563 done
564 -ls -a1 src/gcc/.sym*
565
566all-symlinks-unlink-binutils:
567 for file in $(SYMLINKS_BINUTILS_TO_GCC_FILES); do \
568 if [ -f "$(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'`" ]; then \
569 rm $(PATH_TOP)/src/gcc/$${file} && \
570 rm $(PATH_TOP)/src/gcc/.symlinked.`echo $${file} | sed -e 's@/@_@g'` ; \
571 fi ; \
572 done
573 for dir in $(SYMLINKS_BINUTILS_TO_GCC_DIRS) ; do \
574 if [ -f "$(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'`" ] ; then \
575 $(TOOL_UNSYMLINK_DIR) $(PATH_TOP)/src/gcc/$${dir} && \
576 rm $(PATH_TOP)/src/gcc/.symlinked.`echo $${dir} | sed -e 's@/@_@g'`; \
577 fi ; \
578 done
579 -ls -a1 src/gcc/.sym*
580
581
582###############################################################################
583###############################################################################
584###############################################################################
585#
586# G C C
587#
588###############################################################################
589###############################################################################
590###############################################################################
591all-gcc gcc: \
592 gcc-autoconf-refresh \
593 gcc-build
594 echo "Successfully build GCC."
595
596
597
598GCC_DIRS = \
599gcc/libiberty \
600gcc/zlib \
601gcc/gcc \
602gcc/libstdc++-v3 \
603gcc/boehm-gc \
604gcc/fastjar \
605gcc/libf2c \
606gcc/libf2c/libF77 \
607gcc/libf2c/libI77 \
608gcc/libf2c/libU77 \
609gcc/libffi \
610gcc/libjava \
611gcc/libjava/libltdl \
612gcc/libobjc \
613
614# Here is a problem, we can't regenerate binutils makefiles when symlinked into
615# gcc. At least not yet. The result is messed up severely.
616not_yet =\
617gcc/bfd \
618gcc/binutils \
619gcc/gas \
620gcc/gprof \
621gcc/intl \
622gcc/ld \
623gcc/libiberty \
624gcc/opcodes \
625
626GCC_CONFIGURE_DIRS = $(GCC_DIRS)
627
628
629# configure.in/configure
630.PHONY: gcc-autoconf-refresh gcc-autoconf-rerun gcc-autoconf-clean gcc-autoconf-remove
631gcc-autoconf-refresh gcc-autoconf-rerun gcc-autoconf-clean gcc-autoconf-remove:
632ifeq "$(BUILD_PLATFORM)" "LINUX"
633 -$(SH) $(PATH_TOP)/xfix.sh
634endif
635 for dir in $(GCC_CONFIGURE_DIRS); do \
636 if $(MAKE) $(@:gcc-autoconf-%=%) -f $(PWD)/config.gmk -C src/$$dir ; then \
637 true; \
638 else \
639 exit 8; \
640 fi \
641 done
642
643
644# build the components.
645.PHONY: gcc-build gcc-install gcc-configure
646gcc-build gcc-install gcc-configure:
647 mkdir -p $(PATH_OBJ)/gcc
648 $(MAKE) -C $(PATH_OBJ)/gcc -f $(MAKEFILE) $@-it
649
650
651# When changed directory
652# We pass down BOOT_ flags for stage2+.
653# Because strip is broken on OS/2 we pass -s for release build and -g for
654# non release builds - This overrides some stuff in src/gcc/gcc/config/i386/t-emx!
655# For the 2nd stage we need a hack for using the right specs when linking...
656#SPEC_HACK = $(if $(wildchar $(PATH_OBJ)/.all-stage1),\
657# -specs $(PATH_TOP)/src/emx/src/lib/libc.specs, \
658# -specs $(PATH_TOP)/tools/x86.os2/gcc/staged/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs)
659SPECS_HACK =
660gcc-build-it: \
661 $(PATH_OBJ)/gcc/.ts.configured
662ifeq "$(BUILD_PLATFORM)" "OS2"
663 unset GCCLOAD ; $(MAKE) -C $(PATH_OBJ)/gcc \
664 LIBGCC2_DEBUG_CFLAGS="$(BUILD_DEBUGINFO)" \
665 CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2" \
666 CXXFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2" \
667 BOOT_CFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -O2 -mcpu=pentium -mpreferred-stack-boundary=2 -malign-strings=0 -falign-loops=2 -falign-jumps=2 -falign-functions=2" \
668 LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zexe -Zcrtdll" \
669 BOOT_LDFLAGS="$(SPEC_HACK) $(BUILD_DEBUGINFO) -Zexe -Zcrtdll" \
670 bootstrap
671else
672 $(MAKE) -C $(PATH_OBJ)/gcc bootstrap
673endif
674
675# configure it (invoked after directory change).
676# We set CC to help configure finding it.
677gcc-configure-it $(PATH_OBJ)/gcc/.ts.configured: $(PATH_TOP)/src/gcc/configure
678ifeq "$(BUILD_PLATFORM)" "OS2"
679 $(ASH) -c " \
680 export CC=\"gcc.exe\" ; \
681 $< \
682 --enable-clh \
683 --enable-threads=os2 \
684 --enable-shared=libgcc,bfd,opcodes \
685 --enable-nls \
686 --without-included-gettext \
687 --with-local-prefix=$(subst \,/,$(PATH_EMXPGCC)) \
688 --prefix=$(ALL_PREFIX) \
689 --with-gnu-ld \
690 --with-gnu-as \
691 --disable-libgcj \
692 --enable-languages=c,c++ "
693else
694 $(ASH) -c "$< \
695 --disable-clh \
696 --enable-shared=libgcc,bfd,opcodes \
697 --enable-nls \
698 --without-included-gettext \
699 --with-local-prefix=$(subst \,/,$(PATH_EMXPGCC)) \
700 --prefix=$(ALL_PREFIX) \
701 --with-gnu-ld \
702 --with-gnu-as \
703 --disable-libgcj \
704 --enable-languages=c,c++ "
705endif
706 touch $(PATH_OBJ)/gcc/.ts.configured
707# TODO: Andy, on Linux --enable-clh result in linking errors.
708
709# Install the GCC build
710# Repeating the prefix doesn't hurt anybody.
711gcc-install-it:
712 $(MAKE) prefix=$(ALL_PREFIX) install
713
714
715
716# easy, update src/gcc/gcc/version.c
717gcc-versionstamps:
718 @echo "Version stamping gcc..."
719 mv -f $(PATH_TOP)/src/gcc/gcc/version.c $(PATH_TOP)/src/gcc/gcc/version.tmp.c
720 sed -e '/version_string/s/\([0-9]\.[0-9]*\.[0-9]*\).*/\1 $(INNOTEK_VERSION)";/' \
721 $(PATH_TOP)/src/gcc/gcc/version.tmp.c > $(PATH_TOP)/src/gcc/gcc/version.c
722 rm -f $(PATH_TOP)/src/gcc/gcc/version.tmp.c
723
724
725# Install to builttools directory.
726## WARNING! Another spec HACK!
727gcc-builttools-stage2:
728 $(MAKE) -C $(PATH_OBJ)/gcc prefix=$(PATH_BUILTTOOLS_TMPD) install
729## cp $(PATH_TOP)/src/emx/src/lib/libc.specs $(PATH_OBJ)/gcc/gcc/specs
730
731
732# Generate diffs for GCC (v3.2.2) - part of packing a release.
733.PHONY: gcc-diff $(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff
734gcc-diff: $(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff
735$(ALL_PREFIX)/src/diffs/gcc-$(GCC_VERSION).diff:
736 mkdir -p $(@D)
737 $(TOOL_CVS_DIFF_TREE) $(GCC_CVS_REL) src/gcc > $@
738
739
740
741
742
743
744
745
746###############################################################################
747###############################################################################
748###############################################################################
749#
750# B i n U t i l s
751#
752###############################################################################
753###############################################################################
754###############################################################################
755
756BINUTILS_DIRS = \
757binutils/bfd \
758binutils/opcodes \
759binutils/gas \
760binutils/gprof \
761binutils/binutils \
762binutils/ld \
763
764BINUTILS_NOT_DIRS =\
765binutils/etc \
766binutils/libiberty \
767binutils/intl \
768
769
770BINUTILS_CONFIGURE_DIRS = $(BINUTILS_DIRS) $(BINUTILS_NOT_DIRS)
771
772all-binutils binutils:
773 echo "Binutils are build together with the other GNU Tools in GCC."
774 echo "Separate building of binutils is not configured."
775
776
777
778# configure.in/configure
779.PHONY: binutils-autoconf-refresh binutils-autoconf-rerun binutils-autoconf-clean binutils-autoconf-remove
780binutils-autoconf-refresh binutils-autoconf-rerun binutils-autoconf-clean binutils-autoconf-remove:
781ifeq "$(BUILD_PLATFORM)" "LINUX"
782 -$(SH) $(PATH_TOP)/xfix.sh
783endif
784 for dir in $(BINUTILS_CONFIGURE_DIRS); do \
785 if $(MAKE) $(@:binutils-autoconf-%=%) -f $(PWD)/config.gmk -C src/$$dir ; then \
786 true; \
787 else \
788 exit 8; \
789 fi \
790 done
791
792
793# build the components.
794.PHONY: binutils-build binutils-install binutils-configure
795binutils-build binutils-install binutils-configure:
796 mkdir -p $(PATH_OBJ)/binutils
797 $(MAKE) -C $(PATH_OBJ)/binutils -f $(MAKEFILE) $@-it
798
799
800# When changed directory
801binutils-build-it: \
802 $(PATH_OBJ)/binutils/.ts.configured
803 $(ASH) -c " unset GCCLOAD ; $(MAKE) -C $(PATH_OBJ)/binutils "
804
805# configure it (invoked after directory change).
806# We set CC to help configure finding it.
807# And we reconfigure libiberty to the gcc one.
808binutils-configure-it $(PATH_OBJ)/binutils/.ts.configured: $(PATH_TOP)/src/binutils/configure
809 $(ASH) -c " \
810 export CC=\"gcc.exe\" ; \
811 $< \
812 --enable-shared \
813 --prefix=$(ALL_PREFIX) "
814 $(ASH) -c "cd libiberty && \
815 $(PATH_TOP)/src/gcc/libiberty/configure \
816 --prefix=$(ALL_PREFIX) "
817 touch $(PATH_OBJ)/binutils/.ts.configured
818
819
820# Install the Binutils build
821# Repeating the prefix doesn't hurt anybody.
822binutils-install-it:
823 $(MAKE) prefix=$(ALL_PREFIX) install
824
825
826# Not so easy, need to patch a few files.
827binutils-versionstamps:
828 @echo "Version stamping binutils..."
829 cp -f $(PATH_TOP)/src/binutils/binutils/version.c $(PATH_TOP)/src/binutils/binutils/version.tmp.c
830 sed -e '/printf.*program_version/s/%s %s.*\\n/%s %s $(INNOTEK_VERSION)\\n/' \
831 $(PATH_TOP)/src/binutils/binutils/version.tmp.c > $(PATH_TOP)/src/binutils/binutils/version.c
832 rm -f $(PATH_TOP)/src/binutils/binutils/version.tmp.c
833 if [ -f $(PATH_TOP)/src/gcc/binutils/version.c ]; then \
834 cp -f $(PATH_TOP)/src/gcc/binutils/version.c $(PATH_TOP)/src/gcc/binutils/version.tmp.c && \
835 sed -e '/printf.*program_version/s/%s %s.*\\n/%s %s $(INNOTEK_VERSION)\\n/' \
836 $(PATH_TOP)/src/gcc/binutils/version.tmp.c > $(PATH_TOP)/src/gcc/binutils/version.c && \
837 rm -f $(PATH_TOP)/src/gcc/binutils/version.tmp.c ; \
838 fi
839 @echo "Version stamping gas..."
840 cp -f $(PATH_TOP)/src/binutils/gas/as.c $(PATH_TOP)/src/binutils/gas/as.tmp.c
841 sed -e '/printf.*GNU.*assembler/s/%s.*\\n/%s $(INNOTEK_VERSION)\\n/' \
842 -e '/fprintf.*GNU.*assembler.*version.*BFD.*/s/using BFD version %s.*/using BFD version %s $(INNOTEK_VERSION)"),/ ' \
843 $(PATH_TOP)/src/binutils/gas/as.tmp.c > $(PATH_TOP)/src/binutils/gas/as.c
844 rm -f $(PATH_TOP)/src/binutils/gas/as.tmp.c
845 if [ -f $(PATH_TOP)/src/gcc/gas/as.c ]; then \
846 cp -f $(PATH_TOP)/src/gcc/gas/as.c $(PATH_TOP)/src/gcc/gas/as.tmp.c && \
847 sed -e '/printf.*GNU.*assembler/s/%s.*\\n/%s $(INNOTEK_VERSION)\\n/' \
848 -e '/fprintf.*GNU.*assembler.*version.*BFD.*/s/using BFD version %s.*/using BFD version %s $(INNOTEK_VERSION)"),/ ' \
849 $(PATH_TOP)/src/gcc/gas/as.tmp.c > $(PATH_TOP)/src/gcc/gas/as.c && \
850 rm -f $(PATH_TOP)/src/gcc/gas/as.tmp.c ; \
851 fi
852 @echo "Version stamping ld..."
853 cp -f $(PATH_TOP)/src/binutils/ld/ldver.c $(PATH_TOP)/src/binutils/ld/ldver.tmp.c
854 sed -e '/fprintf.*GNU.*ld.*version/s/(with BFD %s).*/(with BFD %s) $(INNOTEK_VERSION)\\n"),/' \
855 $(PATH_TOP)/src/binutils/ld/ldver.tmp.c > $(PATH_TOP)/src/binutils/ld/ldver.c
856 rm -f $(PATH_TOP)/src/binutils/ld/ldver.tmp.c
857 if [ -f $(PATH_TOP)/src/gcc/ld/ldver.c ]; then \
858 cp -f $(PATH_TOP)/src/gcc/ld/ldver.c $(PATH_TOP)/src/gcc/ld/ldver.tmp.c && \
859 sed -e '/fprintf.*GNU.*ld.*version/s/(with BFD %s).*/(with BFD %s) $(INNOTEK_VERSION)\\n"),/' \
860 $(PATH_TOP)/src/gcc/ld/ldver.tmp.c > $(PATH_TOP)/src/gcc/ld/ldver.c && \
861 rm -f $(PATH_TOP)/src/gcc/ld/ldver.tmp.c ; \
862 fi
863
864
865
866# Generate diffs for Binutils (part of packing).
867.PHONY: binutils-diff $(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff
868binutils-diff: $(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff
869$(ALL_PREFIX)/src/diffs/binutils-$(BINUTILS_VERSION).diff:
870 mkdir -p $(@D)
871 $(TOOL_CVS_DIFF_TREE) $(BINUTILS_CVS_REL) src/binutils > $@
872
873
874
875
876
877
878
879
880###############################################################################
881###############################################################################
882###############################################################################
883#
884# E M X
885#
886###############################################################################
887###############################################################################
888###############################################################################
889all-emx emx: \
890 emx-build
891 @echo "Successfully build EMX."
892
893# Some helpers.
894# TODO: Change OUT and INS to the right ones. Currently not possible as
895# doing such breaks the rules generating.
896EMX_MODE = dbg
897ifeq "$(BUILD_MODE)" "RELEASE"
898EMX_MODE = opt
899endif
900EMX_OUT = out/
901EMX_INS = out/install/
902EMX_RULES= $(PATH_TOP)/src/emx/$(EMX_OUT)$(EMX_MODE)/genrules.smak
903#EMX_OUT = $(PATH_OBJ)/emx/
904#EMX_INS = $(ALL_PREFIX)/
905#EMX_RULES= $(EMX_OUT)$(EMX_MODE)/genrules.smak
906EMX_MASM = $(PATH_TOP)/tools/x86.os2/masm/v6.0/binp/ml.exe
907EMX_DEFINES = OUT=$(EMX_OUT) INS=$(EMX_INS) MODE=$(EMX_MODE) "ASM=$(EMX_MASM) -c"
908
909# build the components. (directory changer rules)
910.PHONY: emx-build emx-install emx-configure
911emx-build emx-install emx-configure:
912 mkdir -p $(PATH_OBJ)/emx
913 $(MAKE) -C $(PATH_TOP)/src/emx -f $(MAKEFILE) $@-it
914
915# This is the configure equivalent.
916emx-configure-it: $(EMX_RULES)
917$(EMX_RULES):
918 rm -f $(EMX_RULES)
919 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) $(EMX_RULES)
920
921# make handle issue here. Make portions at the time.
922emx-build-it: $(EMX_RULES)
923 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) tools
924 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) os2 libsocket libdl
925 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) libs
926 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) all
927
928emx-install-it: $(EMX_RULES)
929 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) INS=$(ALL_PREFIX)/ install
930
931
932# easy, update same stuff in a bunch of files.
933# actually, nothing any long as the global innotekversion.h takes care of it
934# together with proper dependencies.
935EMX_FILE_VER = \
936emxbind/emxbind.h emxcat/emxcat.c emxdoc/emxdoc.c emxexp/emxexp.c emximp/emximp.c \
937emxload/emxload.c emxomf/emxaout.c emxomf/emxomf.c emxomf/emxomfar.c emxomf/emxomfld.c \
938emxomf/listomf.c emxstack/emxstack.c emxtsf/emxtsf.c os2/version.h
939emx-versionstamps:
940 @echo "Version stamping EMX..."
941
942# Install the compiled emx stuff to builttools.
943##emx-builttools-stage2: emx-builttools-stage2-specs
944emx-builttools-stage2:
945 $(MAKE) -C $(PATH_TOP)/src/emx $(EMX_DEFINES) INS=$(PATH_BUILTTOOLS_TMP)/ install
946
947## bird: for now we will just replace the specs with the constantly updated libc specs.
948emx-builttools-stage2-specs:
949## -mv -f $(PATH_BUILTTOOLS_TMP)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs \
950## $(PATH_BUILTTOOLS_TMP)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/emxspecs
951## cp $(PATH_TOP)/src/emx/src/lib/libc.specs \
952## $(PATH_BUILTTOOLS_TMP)/lib/gcc-lib/i386-pc-os2-emx/$(GCC_VERSION)/specs
953
954
955# Generate diffs for Binutils (part of packing).
956.PHONY: binutils-diff $(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff
957emx-diff: $(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff
958$(ALL_PREFIX)/src/diffs/emx-$(EMX_VERSION).diff:
959 mkdir -p $(@D)
960 $(TOOL_CVS_DIFF_TREE) $(EMX_CVS_REL) src/emx > $@
961
962
963
964###############################################################################
965###############################################################################
966###############################################################################
967#
968# M I S C
969#
970###############################################################################
971###############################################################################
972###############################################################################
973
974
975dejagnu:
976# nothing to make at the moment, it's just a all install stuff it seems.
977
978requires_autoconf_2_52_DEJAGNU_CONFIGURE_DIRS = \
979src/misc/dejagnu \
980src/misc/dejagnu/contrib/bluegnu2.0.3 \
981src/misc/dejagnu/contrib/bluegnu2.0.3/doc \
982src/misc/dejagnu/contrib/bluegnu2.0.3/example \
983src/misc/dejagnu/contrib/bluegnu2.0.3/example/calc \
984src/misc/dejagnu/contrib/bluegnu2.0.3/testsuite \
985src/misc/dejagnu/example/calc \
986src/misc/dejagnu/example/hello
987
988.PHONY: dejagnu-autoconf-refresh dejagnu-autoconf-rerun dejagnu-autoconf-clean dejagnu-autoconf-remove
989dejagnu-autoconf-refresh dejagnu-autoconf-rerun dejagnu-autoconf-clean dejagnu-autoconf-remove:
990ifeq "$(BUILD_PLATFORM)" "LINUX"
991 -$(SH) $(PATH_TOP)/xfix.sh
992endif
993 for dir in $(DEJAGNU_CONFIGURE_DIRS); do \
994 if $(MAKE) $(@:dejagnu-autoconf-%=%) -f $(PWD)/config.gmk -C $$dir ; then \
995 true; \
996 else \
997 exit 8; \
998 fi \
999 done
1000
1001
1002
1003#
1004# Expect
1005#
1006
1007expect:
1008
1009
1010# build the components.
1011.PHONY: expect-build expect-install expect-configure
1012expect-build expect-install expect-configure:
1013 mkdir -p $(PATH_OBJ)/misc/expect
1014 $(MAKE) -C $(PATH_OBJ)/misc/expect -f $(MAKEFILE) $@-it
1015
1016
1017# When changed directory
1018expect-build-it: \
1019 $(PATH_OBJ)/misc/expect/.ts.configured
1020 $(MAKE) -C $(PATH_OBJ)/misc/expect
1021
1022# configure it (invoked after directory change).
1023# We set CC to help configure finding it.
1024# And we reconfigure libiberty to the gcc one.
1025expect-configure-it $(PATH_OBJ)/misc/expect/.ts.configured: $(PATH_TOP)/src/misc/expect/configure
1026ifeq "$(BUILD_PLATFORM)" "OS2"
1027 $(ASH) -c " \
1028 export CC=\"gcc.exe\" ; \
1029 $< \
1030 --disable-shared \
1031 --host=i386-pc-os2-emx \
1032 --with-tclconfig=$(UNIXROOT)/usr/lib \
1033 --with-tclinclude=$(UNIXROOT)/usr/lib/tcl8.0/include \
1034 --enable-gcc \
1035 $(BUILD_ENABLE_SYMBOLS) \
1036 --prefix=$(PATH_BUILTTOOLSD) "
1037else
1038 $(ASH) -c " \
1039 $< \
1040 --enable-gcc \
1041 $(BUILD_ENABLE_SYMBOLS) \
1042 --prefix=$(PATH_BUILTTOOLSD) "
1043endif
1044 touch $(PATH_OBJ)/misc/expect/.ts.configured
1045
1046
1047# install to builttools (if anywhere!)
1048expect-install-it:
1049 $(MAKE) prefix=$(PATH_BUILTTOOLSD) install
1050
1051
1052
1053EXPECT_CONFIGURE_DIRS = \
1054src/misc/expect
1055# skipping testsuite for now as it requires some .m4 files we don't have.
1056#src/misc/expect/testsuite
1057
1058.PHONY: expect-autoconf-refresh expect-autoconf-rerun expect-autoconf-clean expect-autoconf-remove
1059expect-autoconf-refresh expect-autoconf-rerun expect-autoconf-clean expect-autoconf-remove:
1060ifeq "$(BUILD_PLATFORM)" "LINUX"
1061 -$(SH) $(PATH_TOP)/xfix.sh
1062endif
1063 for dir in $(EXPECT_CONFIGURE_DIRS); do \
1064 if $(MAKE) $(@:expect-autoconf-%=%) -f $(PWD)/config.gmk -C $$dir ; then \
1065 true; \
1066 else \
1067 exit 8; \
1068 fi \
1069 done
1070
1071
1072
1073# DO NOT DELETE
Note: See TracBrowser for help on using the repository browser.