source: trunk/Makefile@ 251

Last change on this file since 251 was 245, checked in by bird, 22 years ago

corrected genrules.smak location for EMX.

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