1ortho_srcdir=..
2orthobe_srcdir=$(ortho_srcdir)/gcc
3ortho_lang_c=ortho-lang-7.c
4agcc_objdir=.
5agcc_srcdir=$(ortho_srcdir)/gcc
6SED=sed
7BE=gcc
8GNATMAKE=gnatmake
9CC=gcc
10CXX=g++
11COMPILER=$(CXX)
12LINKER=$(CXX)
13
14# Modify AGCC_GCCSRC_DIR and AGCC_GCCOBJ_DIR for your environment
15AGCC_GCCSRC_DIR:=$(HOME)/Projects/gcc4.9.2/source/gcc-4.9.2/
16AGCC_GCCOBJ_DIR:=$(HOME)/Projects/gcc4.9.2/build/
17
18# Supplied by main GCC Makefile, copied here for compatibility with same
19GMPLIBS = -L$(AGCC_GCCOBJ_DIR)./gmp/.libs -L$(AGCC_GCCOBJ_DIR)./mpfr/.libs \
20  -L$(AGCC_GCCOBJ_DIR)./mpc/src/.libs -lmpc -lmpfr -lgmp
21GMPINC = -I$(AGCC_GCCOBJ_DIR)./gmp -I$(AGCC_GCCSRC_DIR)/gmp \
22  -I$(AGCC_GCCOBJ_DIR)./mpfr -I$(AGCC_GCCSRC_DIR)/mpfr \
23  -I$(AGCC_GCCSRC_DIR)/mpc/src
24
25HOST_LIBS =
26ZLIB=-lz
27
28# Override variables in Makefile.conf for your environment
29-include $(orthobe_srcdir)/Makefile.conf
30
31all: $(ortho_exec)
32
33ORTHO_BASENAME=ortho_gcc
34include $(ortho_srcdir)/Makefile.inc
35
36AGCC_INC_FLAGS=-I$(AGCC_GCCOBJ_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/include \
37 -I$(AGCC_GCCSRC_DIR)/gcc -I$(AGCC_GCCSRC_DIR)/gcc/config \
38 -I$(AGCC_GCCSRC_DIR)/libcpp/include $(GMPINC)
39AGCC_CFLAGS=-DIN_GCC_FRONTEND -Wall -DIN_GCC -DHAVE_CONFIG_H $(AGCC_INC_FLAGS)
40
41ortho-lang.o: $(agcc_srcdir)/$(ortho_lang_c) \
42 $(AGCC_GCCOBJ_DIR)gcc/gtype-vhdl.h \
43 $(AGCC_GCCOBJ_DIR)gcc/gt-vhdl-ortho-lang.h
44	$(COMPILER) -c -o $@ $< $(AGCC_CFLAGS) $(CXXFLAGS) $(INCLUDES)
45
46AGCC_LOCAL_OBJS=ortho-lang.o
47
48AGCC_DEPS := $(AGCC_LOCAL_OBJS)
49AGCC_OBJS := $(AGCC_LOCAL_OBJS) \
50	$(AGCC_GCCOBJ_DIR)gcc/attribs.o \
51	$(AGCC_GCCOBJ_DIR)libcpp/libcpp.a \
52	$(AGCC_GCCOBJ_DIR)libiberty/libiberty.a
53
54LIBBACKTRACE = $(AGCC_GCCOBJ_DIR)/libbacktrace/.libs/libbacktrace.a
55LIBDECNUMBER = $(AGCC_GCCOBJ_DIR)/libdecnumber/libdecnumber.a
56LIBIBERTY = $(AGCC_GCCOBJ_DIR)/libiberty/libiberty.a
57CPPLIB= # Not needed for GHDL
58
59BACKEND = $(AGCC_GCCOBJ_DIR)/gcc/libbackend.a \
60         $(AGCC_GCCOBJ_DIR)/gcc/libcommon-target.a
61
62BACKENDLIBS = $(CLOOGLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS) \
63	$(ZLIB)
64LIBS =  $(AGCC_GCCOBJ_DIR)/gcc/libcommon.a \
65        $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBBACKTRACE) \
66	$(LIBIBERTY) $(LIBDECNUMBER) $(HOST_LIBS)
67
68$(ortho_exec): $(AGCC_DEPS) $(orthobe_srcdir)/ortho_gcc.ads force
69	$(GNATMAKE) -o $@ -aI$(ortho_srcdir) \
70	 -aI$(ortho_srcdir)/gcc $(GNATFLAGS) ortho_gcc-main \
71	 -bargs -E -largs --LINK=$(LINKER) $(AGCC_OBJS) \
72        $(BACKEND) $(LIBS) $(BACKENDLIBS)
73
74agcc-clean: force
75	$(RM) -f $(agcc_objdir)/*.o
76	$(RM) -f $(agcc_srcdir)/*~
77
78clean: agcc-clean
79	$(RM) -f *.o *.ali ortho_nodes-main
80	$(RM) b~*.ad? *~
81
82distclean: clean agcc-clean
83
84
85force:
86
87.PHONY: force all clean agcc-clean
88