################################################################################
|
################################################################################
|
#
|
#
|
# Filename: Makefile
|
# Filename: Makefile
|
#
|
#
|
# Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
# Project: Zip CPU -- a small, lightweight, RISC CPU soft core
|
#
|
#
|
# Purpose: This makefile attempts to build the ZipCPU toolchain. This
|
# Purpose: This makefile attempts to build the ZipCPU toolchain. This
|
# includes binutils and GCC. (Eventually, it will include the
|
# includes binutils and GCC. (Eventually, it will include the
|
# standard library as well ...) Configuration options for binutils and
|
# standard library as well ...) Configuration options for binutils and
|
# GCC can be found in the gas-script.sh and gcc-script.sh files
|
# GCC can be found in the gas-script.sh and gcc-script.sh files
|
# respectively.
|
# respectively.
|
#
|
#
|
# Targets:
|
# Targets:
|
# make basic-install
|
# make basic-install
|
# Attempts to build binutils, gcc, and the (now obsolete) zasm
|
# Attempts to build binutils, gcc, and the (now obsolete) zasm
|
# assembler, and to install them into INSTALL directory. This is
|
# assembler, and to install them into INSTALL directory. This is
|
# also the default target.
|
# also the default target.
|
#
|
#
|
# make all:
|
# make all:
|
# Includes the basic-install target, but also the pdf
|
# Includes the basic-install target, but also the pdf
|
# documentation files that come with binutils and gcc. Building
|
# documentation files that come with binutils and gcc. Building
|
# this target will require a LaTeX distribution in addition to the
|
# this target will require a LaTeX distribution in addition to the
|
# needs of the other targets. (These documents may also be found
|
# needs of the other targets. (These documents may also be found
|
# online, and have not been edited as part of the ZipCPU toolchain
|
# online, and have not been edited as part of the ZipCPU toolchain
|
# ... (yet).)
|
# ... (yet).)
|
#
|
#
|
# make clean
|
# make clean
|
#
|
#
|
#
|
#
|
# Creator: Dan Gisselquist, Ph.D.
|
# Creator: Dan Gisselquist, Ph.D.
|
# Gisselquist Technology, LLC
|
# Gisselquist Technology, LLC
|
#
|
#
|
################################################################################
|
################################################################################
|
#
|
#
|
# Copyright (C) 2015, Gisselquist Technology, LLC
|
# Copyright (C) 2015, Gisselquist Technology, LLC
|
#
|
#
|
# This program is free software (firmware): you can redistribute it and/or
|
# This program is free software (firmware): you can redistribute it and/or
|
# modify it under the terms of the GNU General Public License as published
|
# modify it under the terms of the GNU General Public License as published
|
# by the Free Software Foundation, either version 3 of the License, or (at
|
# by the Free Software Foundation, either version 3 of the License, or (at
|
# your option) any later version.
|
# your option) any later version.
|
#
|
#
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
# ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# for more details.
|
# for more details.
|
#
|
#
|
# License: GPL, v3, as defined and found on www.gnu.org,
|
# License: GPL, v3, as defined and found on www.gnu.org,
|
# http://www.gnu.org/licenses/gpl.html
|
# http://www.gnu.org/licenses/gpl.html
|
#
|
#
|
#
|
#
|
################################################################################
|
################################################################################
|
#
|
#
|
basic-install: binutils-install gcc-install zasm-install
|
basic-install: binutils-install gcc-install zasm-install
|
all: basic-install binutils-pdf-install gcc-pdf-install
|
all: basic-install binutils-pdf-install gcc-pdf-install
|
|
|
BINUTILSD=binutils-2.25
|
BINUTILSD=binutils-2.25
|
BUILDGASD=build-gas
|
BUILDGASD=build-gas
|
BUILDGCCD=build-gcc
|
BUILDGCCD=build-gcc
|
INSTALL=`pwd`/install
|
INSTALL=`pwd`/install
|
PDFD=$(INSTALL)/usr/doc
|
PDFD=$(INSTALL)/usr/doc
|
ZASMD=zasm
|
ZASMD=zasm
|
|
|
binutils-2.25: binutils-2.25.tar.bz2 binutils-2.25.patch
|
binutils-2.25: binutils-2.25.tar.bz2 binutils-2.25.patch
|
rm -rf binutils-2.25/
|
rm -rf binutils-2.25/
|
tar -xjf ./binutils-2.25.tar.bz2
|
tar -xjf ./binutils-2.25.tar.bz2
|
bash -c "cd binutils-2.25; patch -p1 <../binutils-2.25.patch"
|
bash -c "cd binutils-2.25; patch -p1 <../binutils-2.25.patch"
|
rm -rf $(BUILDGASD)
|
rm -rf $(BUILDGASD)
|
|
|
.PHONY: binutils
|
.PHONY: binutils
|
binutils: binutils-2.25
|
binutils: binutils-2.25
|
bash -c "if [ ! -e binutils-2.25 ]; then bash gas-script.sh; fi"
|
bash -c "if [ ! -e build-gas ]; then bash gas-script.sh; fi"
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD)
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD)
|
|
|
.PHONY: binutils-install
|
.PHONY: binutils-install
|
binutils-install: binutils
|
binutils-install: binutils
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) install
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) install
|
|
|
.PHONY: binutils-pdf
|
.PHONY: binutils-pdf
|
binutils-pdf: binutils
|
binutils-pdf: binutils
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) pdf
|
$(MAKE) --no-print-directory --directory=$(BUILDGASD) pdf
|
|
|
.PHONY: binutils-pdf-install
|
.PHONY: binutils-pdf-install
|
binutils-pdf-install: binutils-pdf
|
binutils-pdf-install: binutils-pdf
|
mkdir -p $(PDFD)
|
mkdir -p $(PDFD)
|
find $(BUILDGASD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
find $(BUILDGASD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
|
|
|
|
#
|
#
|
#
|
#
|
# Now let's try the same thing for GCC
|
# Now let's try the same thing for GCC
|
#
|
#
|
#
|
#
|
gcc-5.3.0-zip: gcc-5.3.0.tar.bz2 gcc-5.3.0-specs-1.patch gcc-zippatch.patch
|
gcc-5.3.0-zip: gcc-5.3.0.tar.bz2 gcc-5.3.0-specs-1.patch gcc-zippatch.patch
|
rm -rf gcc-5.3.0-zip/
|
rm -rf gcc-5.3.0-zip/
|
tar -xjf ./gcc-5.3.0.tar.bz2 --transform s,gcc-5.3.0,gcc-5.3.0-zip,
|
tar -xjf ./gcc-5.3.0.tar.bz2 --transform s,gcc-5.3.0,gcc-5.3.0-zip,
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-5.3.0-specs-1.patch"
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-5.3.0-specs-1.patch"
|
rm gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h.orig
|
rm gcc-5.3.0-zip/gcc/config/rs6000/sysv4.h.orig
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-zippatch.patch"
|
bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-zippatch.patch"
|
rm -rf $(BUILDGCCD)
|
rm -rf $(BUILDGCCD)
|
|
|
.PHONY: gcc
|
.PHONY: gcc
|
gcc: gcc-5.3.0-zip
|
gcc: gcc-5.3.0-zip
|
bash -c "if [[ ! -e $(BUILDGCCD) ]]; then bash gcc-script.sh; fi"
|
bash -c "if [[ ! -e $(BUILDGCCD) ]]; then bash gcc-script.sh; fi"
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc
|
|
|
.PHONY: gcc-install
|
.PHONY: gcc-install
|
gcc-install: gcc
|
gcc-install: gcc
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc install
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc install
|
|
|
.PHONY: gcc-pdf
|
.PHONY: gcc-pdf
|
gcc-pdf: gcc
|
gcc-pdf: gcc
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD) pdf
|
$(MAKE) --no-print-directory --directory=$(BUILDGCCD) pdf
|
|
|
.PHONY: gcc-pdf-install
|
.PHONY: gcc-pdf-install
|
gcc-pdf-install: gcc-pdf
|
gcc-pdf-install: gcc-pdf
|
mkdir -p $(PDFD)
|
mkdir -p $(PDFD)
|
find $(BUILDGCCD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
find $(BUILDGCCD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
|
|
|
#
|
#
|
#
|
#
|
# Finally, can we build and install zasm?
|
# Finally, can we build and install zasm?
|
#
|
#
|
#
|
#
|
zasm:
|
zasm:
|
$(MAKE) --no-print-directory --directory=$(ZASMD)
|
$(MAKE) --no-print-directory --directory=$(ZASMD)
|
|
|
zasm-install: zasm
|
zasm-install: zasm
|
$(MAKE) --no-print-directory --directory=$(ZASMD) install
|
$(MAKE) --no-print-directory --directory=$(ZASMD) install
|
|
|
#
|
#
|
#
|
#
|
# The clean target
|
# The clean target
|
#
|
#
|
#
|
#
|
.PHONY: clean
|
.PHONY: clean
|
clean:
|
clean:
|
rm -rf $(INSTALL)
|
rm -rf $(INSTALL)
|
rm -rf binutils-2.25 gcc-5.3.0-zip
|
rm -rf binutils-2.25 gcc-5.3.0-zip
|
rm -rf $(BUILDGASD) $(BUILDGCCD)
|
rm -rf $(BUILDGASD) $(BUILDGCCD)
|
$(MAKE) --no-print-directory --directory=$(ZASMD) clean
|
$(MAKE) --no-print-directory --directory=$(ZASMD) clean
|
|
|
|
|