summaryrefslogtreecommitdiff
path: root/src/ortho/gcc/Makefile
blob: 020abe03e8264dc8c69152d624dae2ffaa83f43b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ortho_srcdir=..
orthobe_srcdir=$(ortho_srcdir)/gcc
agcc_objdir=.
agcc_srcdir=$(ortho_srcdir)/gcc
SED=sed
BE=gcc
GNATMAKE=gnatmake
CC=gcc
CXX=g++
COMPILER=$(CXX)
LINKER=$(CXX)

# Modify AGCC_GCCSRC_DIR and AGCC_GCCOBJ_DIR for your environment
AGCC_GCCSRC_DIR:=$(HOME)/Projects/gcc4.9.2/source/gcc-4.9.2/
AGCC_GCCOBJ_DIR:=$(HOME)/Projects/gcc4.9.2/build/

# Supplied by main GCC Makefile, copied here for compatibility with same
GMPLIBS = -L$(AGCC_GCCOBJ_DIR)./gmp/.libs -L$(AGCC_GCCOBJ_DIR)./mpfr/.libs \
  -L$(AGCC_GCCOBJ_DIR)./mpc/src/.libs -lmpc -lmpfr -lgmp
GMPINC = -I$(AGCC_GCCOBJ_DIR)./gmp -I$(AGCC_GCCSRC_DIR)/gmp \
  -I$(AGCC_GCCOBJ_DIR)./mpfr -I$(AGCC_GCCSRC_DIR)/mpfr \
  -I$(AGCC_GCCSRC_DIR)/mpc/src

HOST_LIBS =
ZLIB=-lz

# Override variables in Makefile.conf for your environment
-include $(orthobe_srcdir)/Makefile.conf

all: $(ortho_exec)

ORTHO_BASENAME=ortho_gcc
include $(ortho_srcdir)/Makefile.inc

AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
 -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
 -I$(AGCC_GCCSRC_DIR)/libcpp/include $(GMPINC)
AGCC_CFLAGS=-g -Wall -DIN_GCC $(AGCC_INC_FLAGS)

ortho-lang.o: $(agcc_srcdir)/ortho-lang.c \
 $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
 $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
	$(COMPILER) -c -o $@ $< $(AGCC_CFLAGS) $(INCLUDES)

AGCC_LOCAL_OBJS=ortho-lang.o

AGCC_DEPS := $(AGCC_LOCAL_OBJS)
AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
	$(AGCC_GCCOBJ_DIR)gcc/attribs.o \
	$(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
	$(AGCC_GCCOBJ_DIR)libiberty/libiberty.a

LIBBACKTRACE = $(AGCC_GCCOBJ_DIR)/libbacktrace/.libs/libbacktrace.a
LIBDECNUMBER = $(AGCC_GCCOBJ_DIR)/libdecnumber/libdecnumber.a
LIBIBERTY = $(AGCC_GCCOBJ_DIR)/libiberty/libiberty.a
CPPLIB= # Not needed for GHDL

BACKEND = $(AGCC_GCCOBJ_DIR)/gcc/libbackend.a \
         $(AGCC_GCCOBJ_DIR)/gcc/libcommon-target.a

BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
	$(ZLIB)
LIBS =  $(AGCC_GCCOBJ_DIR)/gcc/libcommon.a \
        $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
	$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)

$(ortho_exec): $(AGCC_DEPS) $(orthobe_srcdir)/ortho_gcc.ads force
	$(GNATMAKE) -o $@ -g -aI$(ortho_srcdir) \
	 -aI$(ortho_srcdir)/gcc $(GNAT_FLAGS) ortho_gcc-main \
	 -bargs -E -largs --LINK=$(LINKER) $(AGCC_OBJS) \
        $(BACKEND) $(LIBS) $(BACKENDLIBS)

agcc-clean: force
	$(RM) -f $(agcc_objdir)/*.o
	$(RM) -f $(agcc_srcdir)/*~

clean: agcc-clean
	$(RM) -f *.o *.ali ortho_nodes-main
	$(RM) b~*.ad? *~

distclean: clean agcc-clean


force:

.PHONY: force all clean agcc-clean