OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [Makefile] - Diff between revs 192 and 202

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 192 Rev 202
################################################################################
################################################################################
#
#
# 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, GCC,
#       GCC can be found in the gas-script.sh and gcc-script.sh files
#       and newlib can be found (and set) in the gas-script.sh, gcc-script.sh,
#       respectively.
#       and nlib-script.sh files respectively.
#
#
# Targets:
# Targets:
#       make basic-install
 
#               Attempts to build binutils, gcc, and the (now obsolete) zasm
 
#               assembler, and to install them into INSTALL directory.  This is
 
#               also the default target.
 
#
#
#       make all:
#       make all:
#               Includes the basic-install target, but also the pdf
#               Includes the install target, but also the pdf documentation
#               documentation files that come with binutils and gcc.  Building
#               files that come with binutils and gcc.  Building this target
#               this target will require a LaTeX distribution in addition to the
#               will require a LaTeX distribution in addition to the needs of
#               needs of the other targets.  (These documents may also be found
#               the other targets.  Since the PDFs can be found on line,
#               online, and have not been edited as part of the ZipCPU toolchain
#               building them is not really necessary, but may be quite useful.
#               ... (yet).)
#
 
#       make install
 
#               Attempts to build binutils, gcc, and newlib, and to install
 
#               them into the local install directory.
 
#
 
#               This is the default target
 
#
 
#       make binutils
 
#       make gcc
 
#       make newlib
 
#               Builds the respective packages
 
#
 
#       make binutils-install
 
#       make gcc-install
 
#       make newlib-install
 
#               Installs the respective packages into the install directory,
 
#               building them first if necessary.
#
#
#       make clean
#       make clean
 
#               Removes all build products--to include the source directories
 
#               that are built from patched tarballs.
#
#
#
#
# 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-2017, 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
.PHONY: all basic-install install build
 
install: basic-install
all: basic-install binutils-pdf-install gcc-pdf-install
all: basic-install binutils-pdf-install gcc-pdf-install
 
basic-install: gas-install gcc-install newlib-install
BINUTILSD=binutils-2.25
build: gas gcc-all nlib
BUILDGASD=build-gas
CC: gcc
BUILDGCCD=build-gcc
 
 
BINUTILSD=binutils-2.27
 
GCCD=gcc-6.2.0
 
NLIBD=newlib-2.5.0
INSTALL=`pwd`/install
INSTALL=`pwd`/install
PDFD=$(INSTALL)/usr/doc
PDFD=$(INSTALL)/usr/doc
ZASMD=zasm
ZASMD=zasm
 
BUILDGASD=build-gas
binutils-2.25: binutils-2.25.tar.bz2 binutils-2.25.patch
BUILDGCCD=build-gcc
        rm -rf binutils-2.25/
BUILDNLIB=build-nlib
        tar -xjf ./binutils-2.25.tar.bz2
SUBMAKE=$(MAKE) --no-print-directory
        bash -c "cd binutils-2.25; patch -p1 <../binutils-2.25.patch"
ZIPINCD=$(INSTALL)/cross-tools/zip/include
 
 
 
$(BINUTILSD)-zip/nonce.txt: $(BINUTILSD).tar.bz2 gas-zippatch.patch
 
        rm -rf $(BINUTILSD)-zip/
 
        tar -xjf ./$(BINUTILSD).tar.bz2 --transform s,$(BINUTILSD),$(BINUTILSD)-zip,
 
        -bash -c "cd $(BINUTILSD)-zip; patch -p1 <../gas-zippatch.patch"
        rm -rf $(BUILDGASD)
        rm -rf $(BUILDGASD)
 
        touch $(BINUTILSD)-zip/nonce.txt
 
 
.PHONY: binutils
$(BUILDGASD)/nonce.txt: $(BINUTILSD)-zip/nonce.txt
binutils: binutils-2.25
 
        bash -c "if [ ! -e build-gas ]; then bash gas-script.sh; fi"
        bash -c "if [ ! -e build-gas ]; then bash gas-script.sh; fi"
        $(MAKE) --no-print-directory --directory=$(BUILDGASD)
        touch $(BUILDGASD)/nonce.txt
 
 
 
.PHONY: binutils
 
binutils: $(BUILDGASD)/nonce.txt
 
        $(SUBMAKE) --directory=$(BUILDGASD)
 
 
.PHONY: binutils-install
.PHONY: binutils-install
binutils-install: binutils
binutils-install: binutils
        $(MAKE) --no-print-directory --directory=$(BUILDGASD) install
        $(SUBMAKE) --directory=$(BUILDGASD) install
 
        cp ../bench/zipsim.ld install/cross-tools/zip/lib/ldscripts
 
 
.PHONY: binutils-pdf
.PHONY: binutils-pdf
binutils-pdf: binutils
binutils-pdf: binutils
        $(MAKE) --no-print-directory --directory=$(BUILDGASD) pdf
        $(SUBMAKE) --directory=$(BUILDGASD) pdf
 
 
 
$(PDFD)/:
 
        bash -c "if [[ ! -d $(PDFD) ]]; then mkdir -p $(PDFD); fi"
 
 
 
.PHONY:
 
pdfd: $(PDFD)/
 
 
.PHONY: binutils-pdf-install
.PHONY: binutils-pdf-install
binutils-pdf-install: binutils-pdf
binutils-pdf-install: binutils-pdf $(PDFD)/
        mkdir -p $(PDFD)
 
        find $(BUILDGASD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
        find $(BUILDGASD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
 
 
 
.PHONY: gas
 
gas: binutils
 
 
 
.PHONY: gas-install
 
gas-install: binutils-install
 
 
 
# We can also set the environment variable DEJAGNU to point to our site .exp
 
# file.
 
gas-check: binutils-install
 
        +$(SUBMAKE) --directory=$(BUILDGASD) check RUNTESTFLAGS="--target_board=zip-sim"
#
#
#
#
# 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
$(GCCD)-zip/nonce.txt: $(GCCD).tar.bz2 gcc-zippatch.patch
        rm -rf gcc-5.3.0-zip/
        rm -rf $(GCCD)-zip/
        tar -xjf ./gcc-5.3.0.tar.bz2 --transform s,gcc-5.3.0,gcc-5.3.0-zip,
        tar -xjf ./$(GCCD).tar.bz2 --transform s,$(GCCD),$(GCCD)-zip,
        bash -c "cd gcc-5.3.0-zip; patch -p1 <../gcc-5.3.0-specs-1.patch"
        -bash -c "cd $(GCCD)-zip; patch -p1 <../gcc-zippatch.patch"
        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"
 
        rm -rf $(BUILDGCCD)
        rm -rf $(BUILDGCCD)
 
        touch $(GCCD)-zip/nonce.txt
 
 
.PHONY: gcc
$(GCCD)-zip/gcc/config/zip/genzipops.c: $(GCCD)-zip/nonce.txt
gcc: gcc-5.3.0-zip
genzipops: $(GCCD)-zip/gcc/config/zip/genzipops.c $(GCCD)-zip/nonce.txt
 
        $(CC) $< -o $@
 
$(GCCD)-zip/gcc/config/zip/zip-ops.md: genzipops
 
        ./genzipops $@
 
 
 
$(BUILDGCCD)/nonce.txt: $(GCCD)-zip/nonce.txt $(GCCD)-zip/gcc/config/zip/zip-ops.md gas-install
        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
        touch $(BUILDGCCD)/nonce.txt
 
 
 
#
 
#
 
# GCC must be done in two parts: The host files first, which don't depend
 
# upon a built compiler, and then all the libraries that depend upon the
 
# built compiler.
 
#
 
#
 
gcc-host: $(BUILDGCCD)/nonce.txt
 
        +$(SUBMAKE) --directory=$(BUILDGCCD) all-host
 
.PHONY: zip-gcc
 
zip-gcc: gcc-host
 
 
 
gcc-install-host: $(BUILDGCCD)/nonce.txt gcc-host
 
        +$(SUBMAKE) --directory=$(BUILDGCCD) install-host
 
 
 
.PHONY: zip-gcc-install
 
zip-gcc-install: gcc-install-host
 
 
 
$(INSTALL)/cross-tools/bin/zip-gcc: zip-gcc-install
 
 
 
$(INSTALL)/cross-tools/bin/zip-cc: zip-gcc-install
 
        bash -c "cd $(INSTALL)/cross-tools/bin; if [[ ! -e zip-cc ]]; then ln -s zip-gcc zip-cc; fi"
 
 
 
.PHONY: gcc-pdf-install
 
#
 
#
 
# Now for the second part of GCC.  This part depends upon newlib as well as
 
# GCC proper.
 
#
 
#
 
.PHONY: gcc
 
gcc: $(BUILDGCCD)/nonce.txt gas-install newlib-install
 
        +$(SUBMAKE) --directory=$(BUILDGCCD)
 
 
.PHONY: gcc-install
.PHONY: gcc-install
gcc-install: gcc
gcc-install: gcc
        $(MAKE) --no-print-directory --directory=$(BUILDGCCD)/gcc install
        +$(SUBMAKE) --directory=$(BUILDGCCD) install
 
 
.PHONY: gcc-pdf
.PHONY: gcc-pdf
gcc-pdf: gcc
gcc-pdf: $(BUILDGCCD)/nonce.txt
        $(MAKE) --no-print-directory --directory=$(BUILDGCCD) pdf
        +$(SUBMAKE) --directory=$(BUILDGCCD) pdf
 
 
.PHONY: gcc-pdf-install
gcc-pdf-install: gcc-pdf $(PDFD)/
gcc-pdf-install: gcc-pdf
 
        mkdir -p $(PDFD)
 
        find $(BUILDGCCD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
        find $(BUILDGCCD) -name "*.pdf" -exec cp \{\} $(PDFD)/ \;
#
#
#
#
 
# And repeat for newlib
 
#
 
#
 
$(NLIBD)-zip/nonce.txt: $(NLIBD).tar.gz nlib-zippatch.patch
 
        rm -rf $(NLIBD)-zip/
 
        tar -xzf ./$(NLIBD).tar.gz --transform s,$(NLIBD),$(NLIBD)-zip,
 
        -bash -c "cd $(NLIBD)-zip; patch -p1 <../nlib-zippatch.patch"
 
        rm -rf $(BUILDNLIB)
 
        touch $(NLIBD)-zip/nonce.txt
 
 
 
$(BUILDNLIB)/nonce.txt: $(NLIBD)-zip/nonce.txt $(BUILDGASD)/nonce.txt
 
        bash nlib-script.sh
 
        touch $(BUILDNLIB)/nonce.txt
 
 
 
.PHONY: newlib
 
newlib: $(BUILDNLIB)/nonce.txt zip-gcc-install
 
newlib: $(INSTALL)/cross-tools/bin/zip-cc
 
        +$(SUBMAKE) --directory=$(BUILDNLIB)
 
 
 
.PHONY: newlib-install
 
newlib-install: newlib
 
        +$(SUBMAKE) --directory=$(BUILDNLIB) install
 
 
 
 
 
# Some abbreviations for targets
 
.PHONY: nlib nlib-install
 
nlib: newlib
 
nlib-install: newlib-install
 
 
 
#
 
#
# Finally, can we build and install zasm?
# Finally, can we build and install zasm?
#
#
#
#
zasm:
# zasm:
        $(MAKE) --no-print-directory --directory=$(ZASMD) all
#       $(SUBMAKE) --directory=$(ZASMD) all
 
 
zasm-install: zasm
# zasm-install: zasm
        $(MAKE) --no-print-directory --directory=$(ZASMD) install
#       $(SUBMAKE) --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 $(BINUTILSD)-zip/ $(GCCD)-zip/ $(NLIBD)-zip/
        rm -rf $(BUILDGASD) $(BUILDGCCD)
        rm -rf $(BUILDGASD) $(BUILDGCCD) $(BUILDNLIB)
        $(MAKE) --no-print-directory --directory=$(ZASMD) clean
        # $(SUBMAKE) --no-print-directory --directory=$(ZASMD) clean
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.