// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "ar9344.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
model = "PowerCloud Systems CR5000";
compatible = "pcs,cr5000", "qca,ar9344";
aliases {
led-boot = &led_power;
led-failsafe = &led_power;
led-running = &led_power;
led-upgrade = &led_power;
};
keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins>;
reset {
label = "Reset button";
linux,code = <KEY_RESTART>;
gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
wps {
label = "WPS button";
linux,code = <KEY_WPS_BUTTON>;
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
led_power: power {
label = "amber:power";
gpios = <&gpio 2 GPIO_ACTIVE_LOW>,
<&gpio 4 GPIO_ACTIVE_LOW>;
default-state = "on";
};
wlan2g {
label = "blue:wlan";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wps_white {
label = "white:wps";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
};
};
};
&ref {
clock-frequency = <25000000>;
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */# Top level -*- Makefile -*- for GHDL.
# Copyright (C) 2002 - 2014 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# GHDL is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING. If not, write to the Free
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
CC=@CC@
CXX=@CXX@
build=@build@
srcdir=@srcdir@
abs_srcdir=@abs_srcdir@
GNATMAKE=@GNATMAKE@
MAKE=@MAKE@
prefix=@prefix@
backend=@backend@
libdirsuffix=@libdirsuffix@
libdirreverse=@libdirreverse@
EXEEXT=@EXEEXT@
SOEXT=@SOEXT@
PIC_FLAGS=@PIC_FLAGS@
gcc_src_dir=@gcc_src_dir@
LLVM_CONFIG=@llvm_config@
LDFLAGS=@LDFLAGS@
LIBBACKTRACE=@backtrace_lib@
llvm_be=@llvm_be@
build_mode=@build_mode@
ghdl_version=@ghdl_version@
libghdl_version=@libghdl_version@
enable_werror=@enable_werror@
enable_checks=@enable_checks@
enable_openieee=@enable_openieee@
enable_libghdl=@enable_libghdl@
default_pic=@default_pic@
INSTALL_PROGRAM=install -m 755
INSTALL_DATA=install -m 644
PWD?=$(shell pwd)
DESTDIR=
bindir=$(prefix)/bin
libdir=$(prefix)/lib
incdir=$(prefix)/include
MKDIR=mkdir
LN=ln -s
CP=cp
MV=mv
SED=sed
GRT_RANLIB=ranlib
GHDL_DESC?=tarball
VHDL_LIB_DIR=$(prefix)/$(libdirsuffix)
ifeq "$(enable_checks)" "true"
# Debug + checks
OPT_FLAGS+=-g
ADA_FLAGS+=-gnata
LIB_CFLAGS+=
else
# Optimize + no checks
ADA_FLAGS+=-gnatpn
OPT_FLAGS+=-O
LIB_CFLAGS=-O
endif
# Profiling.
#ADA_FLAGS+=-gnatn
#OPT_FLAGS+=-pg -O
# Coverage
ifeq "$(build_mode)" "coverage"
OPT_FLAGS+=-fprofile-arcs -ftest-coverage
endif
GNATFLAGS=-gnat12 -gnaty3befhkmr -gnatwa -gnatwC -gnatf $(OPT_FLAGS) $(ADA_FLAGS)
GRT_FLAGS=$(OPT_FLAGS)
ifeq "$(default_pic)" "true"
GRT_FLAGS+=$(PIC_FLAGS)
endif
WARN_CFLAGS=-Wall
GNAT_BARGS=-bargs -E
# Warnings as errors. Comment this line if a warning looks not valid.
ifeq "$(enable_werror)" "true"
GNATFLAGS+=-gnatwe
endif
target=$(build)
#target=i686-pc-linux-gnu
#target=x86_64-pc-linux-gnu
#target=i686-apple-darwin
#target=x86_64-apple-darwin
#target=i386-pc-mingw32
ifeq ($(SOEXT),.so)
SHLIB_FLAGS=-Wl,-soname,$@
else ifeq ($(SOEXT),.dll)
SHLIB_FLAGS=
else ifeq ($(SOEXT),.dylib)
# Allow the use of -rpath in executable
SHLIB_FLAGS=-Wl,-install_name,@rpath/$@
endif
# Flags for libraries
LIBSRC_DIR:=$(srcdir)/libraries
LIBDST_DIR:=$(libdirsuffix)
LIBVHDL_FLAGS_TO_PASS=\
LIBSRC_DIR="$(LIBSRC_DIR)" \
LIBDST_DIR="$(LIBDST_DIR)" \
enable_openieee="$(enable_openieee)" \
LN="$(LN)" CP="$(CP)" MKDIR="$(MKDIR)"
# Object files from grt for the synthesis.
GRT_SYNTH_OBJS=grt-cstdio.o
all: Makefile all.$(backend) all.libghdl
install: install.$(backend)
# Generate std.standard package VHDL source
$(DESTDIR)$(bindir)/ghdl$(EXEEXT) --disp-standard --std=87 > $(DESTDIR)$(VHDL_LIB_DIR)/src/std/v87/standard.vhdl
$(DESTDIR)$(bindir)/ghdl$(EXEEXT) --disp-standard --std=93 > $(DESTDIR)$(VHDL_LIB_DIR)/src/std/v93/standard.vhdl
$(DESTDIR)$(bindir)/ghdl$(EXEEXT) --disp-standard --std=08 > $(DESTDIR)$(VHDL_LIB_DIR)/src/std/v08/standard.vhdl
uninstall: uninstall.$(backend)
test: test.$(backend)
copy-sources: copy-sources.$(backend)
libs: libs.vhdl.$(backend)
./config.status: $(srcdir)/configure
@if [ -e $@ ]; then \
echo "./config.status --reconfigure"; \
./config.status --reconfigure; \
else \
echo "config.status is lost, please configure manually" ; \
exit 1; \
fi
Makefile: $(srcdir)/Makefile.in ./config.status
./config.status
setup.py: $(srcdir)/setup.py.in ./config.status
./config.status
GHDL_COMMON_INCFLAGS=-aI$(srcdir)/src -aI$(srcdir)/src/vhdl -aI$(srcdir)/src/synth -aI$(srcdir)/src/grt -aI$(srcdir)/src/psl -aI$(srcdir)/src/vhdl/translate
GRTSRCDIR=$(abs_srcdir)/src/grt
include $(srcdir)/src/grt/Makefile.inc
version.tmp: $(srcdir)/src/version.in force
# Create version.tmp from version.in, using git date/hash, or envvar GHDL_DESC. Defaults to 'tarball'.
if test -d $(srcdir)/.git && desc=`cd $(srcdir); git describe --dirty`; then GHDL_DESC="$$desc"; fi; \
$(SED) -e "s/[(].*[)]/($$GHDL_DESC)/" -e "s/@VER@/$(ghdl_version)/" < $< > $@; \
version.ads: version.tmp
# Change version.ads only if version.tmp has been modified to avoid
# useless rebuild.
if [ ! -r $@ ] || ! cmp $< $@ > /dev/null; then $(CP) $< $@; fi
#################### For mcode backend ##############################
all.mcode: ghdl_mcode$(EXEEXT) libs.vhdl.mcode all.vpi
GHDL_MCODE_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/ortho -aI$(srcdir)/src/ortho/mcode -aI$(srcdir)/src/synth
ghdl_mcode$(EXEEXT): GRT_FLAGS+=-DWITH_GNAT_RUN_TIME
ghdl_mcode$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \
memsegs_c.o chkstk.o version.ads force
$(GNATMAKE) -o $@ -gnat12 $(GHDL_MCODE_INCFLAGS) $(GNATFLAGS) -gnatw.A ghdl_jit.adb $(GNAT_BARGS) -largs memsegs_c.o chkstk.o $(GRT_ADD_OBJS) $(LDFLAGS) $(GNAT_LARGS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB) $(GRT_EXEC_OPTS))
memsegs_c.o: $(srcdir)/src/ortho/mcode/memsegs_c.c
$(CC) -c $(OPT_FLAGS) -o $@ $<
libs.vhdl.mcode: ghdl_mcode$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_mcode$(EXEEXT) GHDL_FLAGS="" VHDL_COPY_OBJS=no vhdl.libs.all
install.mcode.program: install.dirs ghdl_mcode$(EXEEXT)
$(INSTALL_PROGRAM) ghdl_mcode$(EXEEXT) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
uninstall.mcode.program:
$(RM) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
install.mcode: install.mcode.program install.vhdllib install.vpi install.libghdl
uninstall.mcode: uninstall.mcode.program uninstall.vhdllib uninstall.vpi uninstall.libghdl
test.mcode: ghdl_mcode$(EXEEXT)
cd $(srcdir)/testsuite; GHDL=$(CURDIR)/ghdl_mcode$(EXEEXT) ./testsuite.sh
oread-mcode$(EXEEXT): force
$(MAKE) -f $(srcdir)/src/ortho/mcode/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATFLAGS="-aI$(srcdir)/src/ortho/oread $(GNATFLAGS)" all
#################### For gcc backend ##############################
gcc_vhdl_dir=$(gcc_src_dir)/gcc/vhdl
all.gcc:
@echo "For installing sources in gcc, do:"
@echo "1) $(MAKE) copy-sources"
@echo "2) configure, build and install gcc"
@echo "3) $(MAKE) ghdllib"
@echo "4) $(MAKE) install"
copy-sources.gcc: version.ads
$(RM) -rf $(gcc_vhdl_dir)
$(MKDIR) $(gcc_vhdl_dir)
$(CP) -p version.ads ghdlsynth_maybe.ads $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/vhdl/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/vhdl/translate/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/synth/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/psl/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-types.ads $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-c.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-fcvt.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-algos.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-vstrings.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-cstdio.c $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-stdio.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-table.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-files_operations.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-to_strings.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/grt/grt-severity.ads $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/ortho/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/ortho/gcc/*.ad? $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/ortho/gcc/*.c $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/src/ortho/gcc/*.opt $(gcc_vhdl_dir)
base_ver=`cat $(gcc_src_dir)/gcc/BASE-VER`; \
case $$base_ver in \
4.9*) gcc_ortho_lang=ortho-lang-49.c ;; \
5.*) gcc_ortho_lang=ortho-lang-5.c ;; \
6 | 6.*) gcc_ortho_lang=ortho-lang-6.c ;; \
7.*) gcc_ortho_lang=ortho-lang-7.c ;; \
8.*) gcc_ortho_lang=ortho-lang-8.c ;; \
9.*) gcc_ortho_lang=ortho-lang-9.c ;; \
10.*) gcc_ortho_lang=ortho-lang-9.c ;; \
*) echo "Mismatch gcc version from $(gcc_src_dir)"; \
echo "Need gcc version 4.9.x, 5.x, 6.x, 7.x, 8.x, 9.x or 10.x"; \
exit 1 ;; \
esac; \
$(CP) -p $(srcdir)/src/ortho/gcc/$$gcc_ortho_lang \
$(gcc_vhdl_dir)/ortho-lang.c
$(CP) -p $(srcdir)/doc/ghdl.texi $(srcdir)/doc/ghdl.1 $(gcc_vhdl_dir)
$(MKDIR) $(gcc_vhdl_dir)/ghdldrv
$(CP) -pR $(srcdir)/src/ghdldrv/*.ad? $(gcc_vhdl_dir)/ghdldrv
$(CP) -p $(srcdir)/dist/gcc/Make-lang.in $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/dist/gcc/config-lang.in $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/dist/gcc/lang-options.h $(gcc_vhdl_dir)
$(CP) -p $(srcdir)/dist/gcc/lang-specs.h $(gcc_vhdl_dir)
# To build vhdl libs using a non-installed ghdl, define GHDL_GCC_BIN to the
# path of ghdl and GHDL1_GCC_BIN to path of ghdl1
GHDL_GCC_BIN=$(DESTDIR)$(bindir)/ghdl$(EXEEXT)
GHDL1_GCC_BIN= # --GHDL1=/path/to/ghdl1
libs.vhdl.gcc:
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL="$(GHDL_GCC_BIN)" GHDL_FLAGS="$(GHDL1_GCC_BIN) $(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard
ghdllib: libs.vhdl.gcc $(libdirsuffix)/libgrt.a all.libghdl
install.gcc: install.vhdllib install.grt install.vpi install.libghdl
uninstall.gcc: uninstall.vhdllib uninstall.grt uninstall.vpi uninstall.libghdl
test.gcc:
cd $(srcdir)/testsuite; GHDL=$(GHDL_GCC_BIN) ./testsuite.sh
#################### For gcc backend - development only (local build) ####
GHDL_GCC_INCFLAGS=$(GHDL_COMMON_INCFLAGS)
ghdl1-gcc$(EXEEXT): version.ads force
$(MAKE) -f $(srcdir)/src/ortho/gcc/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATFLAGS="$(GHDL_GCC_INCFLAGS) $(GNATFLAGS)" all
ghdl_gcc$(EXEEXT): version.ads $(GRT_SYNTH_OBJS) force
$(GNATMAKE) $(GHDL_GCC_INCFLAGS) -aI$(srcdir)/src/ghdldrv \
$(GNATFLAGS) ghdl_gcc $(GNAT_BARGS) \
-largs $(GRT_SYNTH_OBJS) $(GNAT_LARGS)
libs.vhdl.local_gcc: ghdl_gcc$(EXEEXT) ghdl1-gcc$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_gcc$(EXEEXT) GHDL_FLAGS="--GHDL1=$(PWD)/ghdl1-gcc$(EXEEXT) $(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard
ghdl1-debug$(EXEEXT): version.ads force
$(MAKE) -f $(srcdir)/src/ortho/debug/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATFLAGS="$(GHDL_GCC_INCFLAGS) $(GNATFLAGS)" \
GNATMAKE="$(GNATMAKE)" all
oread-gcc$(EXEEXT): force
$(MAKE) -f $(srcdir)/src/ortho/gcc/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATFLAGS="-aI$(srcdir)/src/ortho/oread $(GNATFLAGS)" all
#################### For llvm backend ##############################
GHDL_LLVM_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/ortho -aI$(srcdir)/src/ortho/$(llvm_be) -aI$(srcdir)/src/synth
all.llvm: ghdl1-llvm$(EXEEXT) ghdl_llvm$(EXEEXT) grt-all libs.vhdl.llvm all.vpi
all.llvm_jit: ghdl_llvm_jit$(EXEEXT)
ghdl_llvm_jit$(EXEEXT): GRT_FLAGS+=-DWITH_GNAT_RUN_TIME
ghdl_llvm_jit$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \
llvm-cbindings.o version.ads force
$(GNATMAKE) -o $@ $(GHDL_LLVM_INCFLAGS) $(GNATFLAGS) ghdl_jit.adb \
$(GNAT_BARGS) -largs llvm-cbindings.o $(GNAT_LARGS) $(GRT_ADD_OBJS) \
$(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB)) --LINK=$(CXX) \
`$(LLVM_CONFIG) --ldflags --libs --system-libs` $(LDFLAGS)
llvm-cbindings.o: $(srcdir)/src/ortho/$(llvm_be)/llvm-cbindings.cpp
$(CXX) -c `$(LLVM_CONFIG) --includedir --cxxflags` \
$(OPT_FLAGS) -o $@ $<
libs.vhdl.llvmjit: ghdl_llvm_jit$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_llvm$(EXEEXT) GHDL_FLAGS="" VHDLLIBS_COPY_OBJS=no vhdl.libs.all
libs.vhdl.llvm: ghdl_llvm$(EXEEXT) ghdl1-llvm$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_llvm$(EXEEXT) GHDL_FLAGS="--GHDL1=$(PWD)/ghdl1-llvm$(EXEEXT) $(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard
libs.vhdl.debug-llvm: ghdl_llvm$(EXEEXT) ghdl1-debug$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_llvm$(EXEEXT) GHDL_FLAGS="--GHDL1=$(PWD)/ghdl1-debug$(EXEEXT) $(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard
ghdl_llvm$(EXEEXT): version.ads $(GRT_SYNTH_OBJS) force
$(GNATMAKE) $(GHDL_LLVM_INCFLAGS) \
-aI$(srcdir)/src/ghdldrv $(GNATFLAGS) \
ghdl_llvm $(GNAT_BARGS) \
-largs $(LDFLAGS) $(GRT_SYNTH_OBJS) $(GNAT_LARGS)
ghdl1-llvm$(EXEEXT): version.ads force
$(MAKE) -f $(srcdir)/src/ortho/$(llvm_be)/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATFLAGS="$(GHDL_LLVM_INCFLAGS) $(GNATFLAGS)" LDFLAGS="$(LDFLAGS)" \
LLVM_CONFIG="$(LLVM_CONFIG)" CXX="$(CXX)" \
CFLAGS="$(WARN_FLAGS) $(OPT_FLAGS)" \
GNATMAKE="$(GNATMAKE)" all
oread-llvm$(EXEEXT): force
$(MAKE) -f $(srcdir)/src/ortho/$(llvm_be)/Makefile \
ortho_srcdir=$(srcdir)/src/ortho ortho_exec=$@ \
GNATMAKE="$(GNATMAKE)" \
GNATFLAGS="-aI$(srcdir)/src/ortho/oread $(GNATFLAGS)" \
LLVM_CONFIG="$(LLVM_CONFIG)" CXX="$(CXX)"
install.llvm.program: install.dirs ghdl1-llvm$(EXEEXT) ghdl_llvm$(EXEEXT)
$(INSTALL_PROGRAM) ghdl_llvm$(EXEEXT) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
$(INSTALL_PROGRAM) ghdl1-llvm$(EXEEXT) $(DESTDIR)$(bindir)/ghdl1-llvm$(EXEEXT)
test.llvm: ghdl_llvm$(EXEEXT)
cd $(srcdir)/testsuite; GHDL=$(CURDIR)/ghdl_llvm$(EXEEXT) ./testsuite.sh
uninstall.llvm.program:
$(RM) $(DESTDIR)$(bindir)/ghdl1-llvm$(EXEEXT)
$(RM) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
install.llvm: install.llvm.program install.vhdllib install.grt install.vpi install.libghdl
uninstall.llvm: uninstall.llvm.program uninstall.vhdllib uninstall.grt uninstall.vpi uninstall.libghdl
################ For simul (no code generation, interpretation) ##########
GHDL_SIMUL_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/ghdldrv -aI$(srcdir)/src/vhdl/simulate -aI$(srcdir)/src/synth
ghdl_simul$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) version.ads force
$(GNATMAKE) $(GHDL_SIMUL_INCFLAGS) $(GNATFLAGS) -gnat12 ghdl_simul $(GNAT_BARGS) -largs $(GNAT_LARGS) $(GRT_ADD_OBJS) $(subst @,$(GRTSRCDIR),$(GRT_EXTRA_LIB))
libs.vhdl.simul: ghdl_simul$(EXEEXT)
$(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_simul$(EXEEXT) GHDL_FLAGS="" VHDLLIBS_COPY_OBJS=no vhdl.libs.all
install.simul.program: install.dirs ghdl_simul$(EXEEXT)
$(INSTALL_PROGRAM) ghdl_simul$(EXEEXT) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
uninstall.simul.program:
$(RM) $(DESTDIR)$(bindir)/ghdl$(EXEEXT)
install.simul: install.simul.program install.vhdllib
uninstall.simul: uninstall.simul.program uninstall.vhdllib
################ libghdl (library for the vhdl part) ####################
LIBGHDL_INCFLAGS=$(GHDL_COMMON_INCFLAGS) -aI$(srcdir)/src/synth -aI$(srcdir)/src/vhdl/libghdl -aI$(srcdir)/src/ghdldrv
libghdl_name=libghdl-$(libghdl_version)$(SOEXT)
LIBGHDL_GRT_OBJS= pic/grt-cstdio.o
$(libghdl_name): $(GRT_SRC_DEPS) $(LIBGHDL_GRT_OBJS) version.ads force
# Use -g for gnatlink so that the binder file is not removed. We need
# it for libghdl.a
$(GNATMAKE) -I- -aI. -D pic -z libghdl -o $@ -gnat12 $(GNATFLAGS) $(PIC_FLAGS) $(LIBGHDL_INCFLAGS) -bargs -shared -Llibghdl_ -largs -g -shared $(SHLIB_FLAGS) $(LIBGHDL_GRT_OBJS)
# On windows, gnatmake (via Osint.Executable_Name) always appends .exe
# Adjust. (Other solution: use gnatmake for compilation and binding,
# then use gnatlink directly for linking).
ifeq ($(SOEXT),.dll)
-mv $(libghdl_name).exe $(libghdl_name)
endif
libghdl.a: $(libghdl_name)
# Also create a static library
sed -e '1,/-- BEGIN/d' -e '/-- END/,$$d' -e 's/^ -- //' < b~libghdl.adb > libghdl.bind
$(RM) -f $@
ar rc $@ b~libghdl.o $(LIBGHDL_GRT_OBJS) `sed -e /^-/d < libghdl.bind`
grep adalib libghdl.bind | sed -e 's/^-L//' -e 's@adalib/@adalib/libgnat.a@' > libghdl.link
$(srcdir)/src/synth/ghdlsynth_gates.h: $(srcdir)/src/synth/netlists.ads $(srcdir)/src/synth/netlists-gates.ads
echo "/* DO NOT MODIFY" > $@
echo " This file is automatically generated by Makefile. */" >> $@
echo "enum Module_Id {" >> $@
grep -h "constant Module_Id :=" $^ | sed -e '/constant Module_Id :=/s/:.*://' -e 's/;/,/' -e 's/ *--.*//' >> $@
echo "};" >> $@
echo "" >> $@
echo "enum Param_Type {" >> $@
grep ' Param_' $(srcdir)/src/synth/netlists.ads >> $@
echo "};" >> $@
all.libghdl.true: $(libghdl_name) libghdl.a
all.libghdl.false:
all.libghdl: all.libghdl.$(enable_libghdl)
install.libghdl.include: install.dirs $(srcdir)/src/synth/ghdlsynth_gates.h
$(INSTALL_DATA) -p $(srcdir)/src/synth/ghdlsynth.h $(DESTDIR)$(incdir)/
$(INSTALL_DATA) -p $(srcdir)/src/synth/ghdlsynth_gates.h $(DESTDIR)$(incdir)/
install.libghdl.lib:
$(INSTALL_PROGRAM) -p $(libghdl_name) $(DESTDIR)$(libdir)/
$(INSTALL_PROGRAM) -p libghdl.a $(DESTDIR)$(libdir)/
$(INSTALL_DATA) -p libghdl.link $(DESTDIR)$(libdir)/
install.libghdl.true: install.libghdl.lib install.libghdl.include
install.libghdl.false:
install.libghdl: install.libghdl.$(enable_libghdl)
uninstall.libghdl:
$(RM) $(DESTDIR)$(libdir)/$(libghdl_name)
libghdl-py.tgz:
[ -d pythonb ] || $(MKDIR) pythonb
$(CP) -r $(srcdir)/python/libghdl $(srcdir)/python/setup.py pythonb
tar -zcvf $@ -C pythonb .
################ ghwdump #################################################
GHWDUMP_OBJS=ghwdump.o ghwlib.o
ghwdump: $(GHWDUMP_OBJS)
$(CC) -o $@ $(GHWDUMP_OBJS)
ghwdump.o: $(srcdir)/src/grt/ghwdump.c $(srcdir)/src/grt/ghwlib.h
$(CC) -c -o $@ $< $(OPT_FLAGS) $(WARN_CFLAGS)
ghwlib.o: $(srcdir)/src/grt/ghwlib.c $(srcdir)/src/grt/ghwlib.h
$(CC) -c -o $@ $< $(OPT_FLAGS) $(WARN_CFLAGS)
############### grt #####################################################
install.grt: \
$(libdirsuffix)/libgrt.a \
$(libdirsuffix)/grt.lst \
$(libdirsuffix)/grt-exec.lst \
$(libdirsuffix)/grt-shared.lst \
install.dirs
$(INSTALL_DATA) $(libdirsuffix)/libgrt.a $(DESTDIR)$(VHDL_LIB_DIR)/libgrt.a
$(INSTALL_DATA) $(libdirsuffix)/grt.lst $(DESTDIR)$(VHDL_LIB_DIR)/grt.lst
$(INSTALL_DATA) $(libdirsuffix)/grt-exec.lst $(DESTDIR)$(VHDL_LIB_DIR)/grt-exec.lst
$(INSTALL_DATA) $(libdirsuffix)/grt-shared.lst $(DESTDIR)$(VHDL_LIB_DIR)/grt-shared.lst
$(INSTALL_DATA) $(GRTSRCDIR)/grt.ver $(DESTDIR)$(VHDL_LIB_DIR)/grt.ver
test "x$(LIBBACKTRACE)" = x || test "x$(backend)" = xgcc || \
$(INSTALL_DATA) $(LIBBACKTRACE) $(DESTDIR)$(VHDL_LIB_DIR)/libbacktrace.a
uninstall.grt:
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/libgrt.a
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/grt.lst
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/grt-exec.lst
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/grt-shared.lst
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/grt.ver
$(RM) $(DESTDIR)$(VHDL_LIB_DIR)/libbacktrace.a
################ VPI #####################################################
vpi_thunk.o: $(GRTSRCDIR)/vpi_thunk.c $(GRTSRCDIR)/vpi_thunk.h
# Do not use OPT_FLAGS (do not enable coverage)
$(CC) -c -o $@ $< $(PIC_FLAGS) -O $(WARN_CFLAGS)
libghdlvpi$(SOEXT): vpi_thunk.o
$(CC) -o $@ $< -shared $(SHLIB_FLAGS)
all.vpi: libghdlvpi$(SOEXT)
install.vpi: all.vpi install.dirs
$(INSTALL_PROGRAM) -p libghdlvpi$(SOEXT) $(DESTDIR)$(libdir)/
$(INSTALL_DATA) -p $(GRTSRCDIR)/vpi_user.h $(DESTDIR)$(incdir)/
uninstall.vpi:
$(RM) -f $(DESTDIR)$(libdir)/libghdlvpi$(SOEXT)
$(RM) -f $(DESTDIR)$(incdir)/vpi_user.h
install.vpi.local: all.vpi
$(MKDIR) -p include lib
$(INSTALL_DATA) -p $(GRTSRCDIR)/vpi_user.h include/
$(INSTALL_PROGRAM) -p libghdlvpi$(SOEXT) lib/
################ Libraries ###############################################
VHDLLIB_SUBDIRS_COMMON= src/std src/std/v87 src/std/v93 src/std/v08 \
src/synopsys src/synopsys/v08 \
std/v87 ieee/v87 \
std/v93 ieee/v93 \
std/v08 ieee/v08 \
src/openieee
VHDLLIB_SUBDIRS_FULL= src/ieee src/vital95 src/vital2000 \
src/ieee/v87 src/ieee/v93 src/ieee2008
ifeq ($(enable_openieee),false)
VHDLLIB_SUBDIRS=$(VHDLLIB_SUBDIRS_COMMON) $(VHDLLIB_SUBDIRS_FULL)
else
VHDLLIB_SUBDIRS=$(VHDLLIB_SUBDIRS_COMMON) \
src/openieee/v87 src/openieee/v93 src/openieee/v08
endif
install.dirs:
# Use -p to create parents and to avoid error if existing.
$(MKDIR) -p $(DESTDIR)$(prefix)
$(MKDIR) -p $(DESTDIR)$(bindir)
$(MKDIR) -p $(DESTDIR)$(libdir)
$(MKDIR) -p $(DESTDIR)$(prefix)/$(libdirsuffix)
$(MKDIR) -p $(DESTDIR)$(incdir)
install.vhdllib: install.dirs
# Libraries (only if not empty)
for d in $(VHDLLIB_SUBDIRS); do \
$(MKDIR) -p $(DESTDIR)$(VHDL_LIB_DIR)/$$d; \
$(INSTALL_DATA) -p \
$(LIBDST_DIR)/$$d/* $(DESTDIR)$(VHDL_LIB_DIR)/$$d; \
done
# ANSI color
$(INSTALL_DATA) -p \
$(srcdir)/dist/ansi_color.sh $(DESTDIR)$(VHDL_LIB_DIR)/;
# Vendors scripts
$(MKDIR) -p $(DESTDIR)$(VHDL_LIB_DIR)/vendors
$(INSTALL_DATA) -p \
$(LIBSRC_DIR)/vendors/* $(DESTDIR)$(VHDL_LIB_DIR)/vendors/
$(INSTALL_PROGRAM) -p \
$(LIBSRC_DIR)/vendors/*.sh $(DESTDIR)$(VHDL_LIB_DIR)/vendors/
uninstall.vhdllib:
$(RM) -rf $(DESTDIR)$(VHDL_LIB_DIR)
####################### clean ############################################
clean: force
$(RM) -f *.o *.ali b~*.ad? *~ *.d b__*.ad? *.a *.so *.deps *.bexch version.* *.dll *.dylib
$(RM) -f ghdl_gcc$(EXEEXT) ghdl_mcode$(EXEEXT) ghdl$(EXEEXT) ghdl_llvm$(EXEEXT) ghdl_llvm_jit$(EXEEXT) ghdl_simul$(EXEEXT)
$(RM) -f ghdl1-gcc$(EXEEXT) ghdl1-llvm$(EXEEXT) ghdl1-debug$(EXEEXT)
$(RM) -f grt/run-bind.ad? grt.lst grt/grt-files grt/grt-files.in
$(RM) -f grt/*.o grt/*.ali
$(RM) -rf lib
$(MAKE) create-dirs
distclean: clean
$(RM) -f default_paths.ads ortho_code-x86-flags.ads
$(RM) -f grt/grt-backtrace-impl.ads
$(RM) -f Makefile config.status ghdl.gpr
clean-c: force
$(RM) -f memsegs_c.o chkstk.o jumps.o times.o
$(RM) -f grt-cstdio.o grt-cgnatrts.o grt-modules.o
$(RM) -f grt-cvpi.o grt-cdynload.o
$(RM) -f fstapi.o fastlz.o lz4.o
$(RM) -f pic/times.o pic/grt-cvpi.o pic/jumps.o
$(RM) -f pic/grt-cstdio.o pic/grt-cgnatrts.o pic/grt-modules.o
$(RM) -f pic/grt-cdynload.o
create-dirs: force
for d in $(VHDLLIB_SUBDIRS); do \
$(MKDIR) -p $(LIBDST_DIR)/$$d; \
done
# Remove non GPL compatible source files
clean-pure-gpl:
# IEEE 1164 or vital libraries aren't GPL compatible
$(RM) -rf libraries/ieee libraries/ieee2008
$(RM) -rf libraries/vital95 libraries/vital2000
# The GNA testsuite contains open-source reproducer that may not be GPL.
$(RM) -rf testsuite/gna
force:
.PHONY: force clean distclean clean-c clean-pure-gpl
# Most of the compilation is done through gnatmake, so using make -jX it not
# very effective.
# Hint: for parallel build use: make GNATMAKE="gnatmake -j8"
# Parallel builds may fail with the llvm backend as it can start two gnatmake
# in parallel: one for ghdl_llvm and the other for ghdl1-llvm. But they
# share the same objects.
# Any better fix is welcome!
.NOTPARALLEL: