| 1 |
111 |
dgisselq |
################################################################################
|
| 2 |
|
|
#
|
| 3 |
|
|
# Filename: Makefile
|
| 4 |
|
|
#
|
| 5 |
|
|
# Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
| 6 |
|
|
#
|
| 7 |
|
|
# Purpose: This makefile attempts to build the ZipCPU toolchain. This
|
| 8 |
|
|
# includes binutils and GCC. (Eventually, it will include the
|
| 9 |
|
|
# standard library as well ...) Configuration options for binutils and
|
| 10 |
|
|
# GCC can be found in the gas-script.sh and gcc-script.sh files
|
| 11 |
|
|
# respectively.
|
| 12 |
|
|
#
|
| 13 |
|
|
# Targets:
|
| 14 |
|
|
# make basic-install
|
| 15 |
|
|
# Attempts to build binutils, gcc, and the (now obsolete) zasm
|
| 16 |
|
|
# assembler, and to install them into INSTALL directory. This is
|
| 17 |
|
|
# also the default target.
|
| 18 |
|
|
#
|
| 19 |
|
|
# make all:
|
| 20 |
|
|
# Includes the basic-install target, but also the pdf
|
| 21 |
|
|
# documentation files that come with binutils and gcc. Building
|
| 22 |
|
|
# this target will require a LaTeX distribution in addition to the
|
| 23 |
|
|
# needs of the other targets. (These documents may also be found
|
| 24 |
|
|
# online, and have not been edited as part of the ZipCPU toolchain
|
| 25 |
|
|
# ... (yet).)
|
| 26 |
|
|
#
|
| 27 |
|
|
# make clean
|
| 28 |
|
|
#
|
| 29 |
|
|
#
|
| 30 |
|
|
# Creator: Dan Gisselquist, Ph.D.
|
| 31 |
|
|
# Gisselquist Technology, LLC
|
| 32 |
|
|
#
|
| 33 |
|
|
################################################################################
|
| 34 |
|
|
#
|
| 35 |
|
|
# Copyright (C) 2015, Gisselquist Technology, LLC
|
| 36 |
|
|
#
|
| 37 |
|
|
# This program is free software (firmware): you can redistribute it and/or
|
| 38 |
|
|
# modify it under the terms of the GNU General Public License as published
|
| 39 |
|
|
# by the Free Software Foundation, either version 3 of the License, or (at
|
| 40 |
|
|
# your option) any later version.
|
| 41 |
|
|
#
|
| 42 |
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
| 43 |
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
| 44 |
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 45 |
|
|
# for more details.
|
| 46 |
|
|
#
|
| 47 |
|
|
# License: GPL, v3, as defined and found on www.gnu.org,
|
| 48 |
|
|
# http://www.gnu.org/licenses/gpl.html
|
| 49 |
|
|
#
|
| 50 |
|
|
#
|
| 51 |
|
|
################################################################################
|
| 52 |
|
|
#
|
| 53 |
|
|
basic-install: binutils-install gcc-install zasm-install
|
| 54 |
|
|
all: basic-install binutils-pdf-install gcc-pdf-install
|
| 55 |
94 |
dgisselq |
|
| 56 |
|
|
BINUTILSD=binutils-2.25
|
| 57 |
111 |
dgisselq |
BUILDGASD=build-gas
|
| 58 |
|
|
BUILDGCCD=build-gcc
|
| 59 |
|
|
INSTALL=`pwd`/install
|
| 60 |
|
|
PDFD=$(INSTALL)/usr/doc
|
| 61 |
94 |
dgisselq |
ZASMD=zasm
|
| 62 |
|
|
|
| 63 |
111 |
dgisselq |
binutils-2.25: binutils-2.25.tar.bz2 binutils-2.25.patch
|
| 64 |
|
|
rm -rf binutils-2.25/
|
| 65 |
|
|
tar -xjf ./binutils-2.25.tar.bz2
|
| 66 |
|
|
bash -c "cd binutils-2.25; patch -p1 <../binutils-2.25.patch"
|
| 67 |
|
|
rm -rf $(BUILDGASD)
|
| 68 |
|
|
|
| 69 |
|
|
.PHONY: binutils
|
| 70 |
|
|
binutils: binutils-2.25
|
| 71 |
94 |
dgisselq |
bash -c "if [ ! -e binutils-2.25 ]; then bash gas-script.sh; fi"
|
| 72 |
111 |
dgisselq |
$(MAKE) --no-print-directory --directory=$(BUILDGASD)
|
| 73 |
94 |
dgisselq |
|
| 74 |
111 |
dgisselq |
.PHONY: binutils-install
|
| 75 |
|
|
binutils-install: binutils
|
| 76 |
|
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) install
|
| 77 |
94 |
dgisselq |
|
| 78 |
111 |
dgisselq |
.PHONY: binutils-pdf
|
| 79 |
|
|
binutils-pdf: binutils
|
| 80 |
|
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) pdf
|
| 81 |
|
|
|
| 82 |
|
|
.PHONY: binutils-pdf-install
|
| 83 |
|
|
binutils-pdf-install: binutils-pdf
|
| 84 |
|
|
mkdir -p $(PDFD)
|
| 85 |
|
|
find $(BUILDGASD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
| 86 |
|
|
|
| 87 |
|
|
|
| 88 |
|
|
#
|
| 89 |
|
|
#
|
| 90 |
|
|
# Now let's try the same thing for GCC
|
| 91 |
|
|
#
|
| 92 |
|
|
#
|
| 93 |
|
|
gcc-5.3.0-zip: gcc-5.3.0.tar.bz2 gcc-5.3.0-specs-1.patch gcc-zippatch.patch
|
| 94 |
|
|
rm -rf gcc-5.3.0-zip/
|
| 95 |
|
|
tar -xjf ./gcc-5.3.0.tar.bz2 --transform s,gcc-5.3.0,gcc-5.3.0-zip,
|
| 96 |
|
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-5.3.0-specs-1.patch"
|
| 97 |
|
|
rm gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h.orig
|
| 98 |
|
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-zippatch.patch"
|
| 99 |
|
|
rm -rf $(BUILDGCCD)
|
| 100 |
|
|
|
| 101 |
|
|
.PHONY: gcc
|
| 102 |
|
|
gcc: gcc-5.3.0-zip
|
| 103 |
|
|
bash -c "if [[ ! -e $(BUILDGCCD) ]]; then gcc-script.sh; fi"
|
| 104 |
|
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc
|
| 105 |
|
|
|
| 106 |
|
|
.PHONY: gcc-install
|
| 107 |
|
|
gcc-install: gcc
|
| 108 |
|
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc install
|
| 109 |
|
|
|
| 110 |
|
|
.PHONY: gcc-pdf
|
| 111 |
|
|
gcc-pdf: gcc
|
| 112 |
|
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD) pdf
|
| 113 |
|
|
|
| 114 |
|
|
.PHONY: gcc-pdf-install
|
| 115 |
|
|
gcc-pdf-install: gcc-pdf
|
| 116 |
|
|
mkdir -p $(PDFD)
|
| 117 |
|
|
find $(BUILDGCCD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
| 118 |
|
|
|
| 119 |
|
|
#
|
| 120 |
|
|
#
|
| 121 |
|
|
# Finally, can we build and install zasm?
|
| 122 |
|
|
#
|
| 123 |
|
|
#
|
| 124 |
94 |
dgisselq |
zasm:
|
| 125 |
|
|
$(MAKE) --no-print-directory --directory=$(ZASMD)
|
| 126 |
111 |
dgisselq |
|
| 127 |
|
|
zasm-install: zasm
|
| 128 |
|
|
$(MAKE) --no-print-directory --directory=$(ZASMD) install
|
| 129 |
|
|
|
| 130 |
|
|
#
|
| 131 |
|
|
#
|
| 132 |
|
|
# The clean target
|
| 133 |
|
|
#
|
| 134 |
|
|
#
|
| 135 |
|
|
.PHONY: clean
|
| 136 |
|
|
clean:
|
| 137 |
|
|
rm -rf $(INSTALL)
|
| 138 |
|
|
rm -rf binutils-2.25 gcc-5.3.0-zip
|
| 139 |
|
|
rm -rf $(BUILDGASD) $(BUILDGCCD)
|
| 140 |
|
|
$(MAKE) --no-print-directory --directory=$(ZASMD) clean
|
| 141 |
|
|
|