diff options
author | Tristan Gingold <tgingold@free.fr> | 2017-05-23 05:05:07 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2017-05-23 05:05:07 +0200 |
commit | e05dcd442052b8dfc30cbad042886e14826b1e4b (patch) | |
tree | 93a0eb5920dcaa70ed88bb867ebc3c3406f281a7 | |
parent | 261de25d3fa108b22b4eaff57ee102f1440d9c8a (diff) | |
download | ghdl-e05dcd442052b8dfc30cbad042886e14826b1e4b.tar.gz ghdl-e05dcd442052b8dfc30cbad042886e14826b1e4b.tar.bz2 ghdl-e05dcd442052b8dfc30cbad042886e14826b1e4b.zip |
Rework of libraries/Makefile.in
For #352
-rw-r--r-- | Makefile.in | 61 | ||||
-rw-r--r-- | libraries/Makefile.inc | 34 |
2 files changed, 46 insertions, 49 deletions
diff --git a/Makefile.in b/Makefile.in index cc9c931d3..38b1cf590 100644 --- a/Makefile.in +++ b/Makefile.in @@ -99,6 +99,15 @@ else ifeq ($(SOEXT),.dylib) 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)" \ + LN="$(LN)" CP="$(CP)" MKDIR="$(MKDIR)" + all: Makefile all.$(backend) install: install.$(backend) @@ -154,7 +163,8 @@ ghdl_mcode$(EXEEXT): $(GRT_ADD_OBJS) $(GRT_SRC_DEPS) $(ORTHO_DEPS) \ memsegs_c.o: $(srcdir)/src/ortho/mcode/memsegs_c.c $(CC) -c $(OPT_FLAGS) -o $@ $< -libs.vhdl.mcode: vhdl.libs.all +libs.vhdl.mcode: force + $(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) @@ -212,7 +222,7 @@ copy-sources.gcc: version.ads $(CP) -p $(srcdir)/dist/gcc/lang-specs.h $(gcc_vhdl_dir) libs.vhdl.gcc: - $(MAKE) GHDL=$(bindir)/ghdl$(EXEEXT) vhdl.libs.all libs.vhdl.standard + $(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(bindir)/ghdl$(EXEEXT) GHDL_FLAGS="$(LIB_CFLAGS)" vhdl.libs.all libs.vhdl.standard ghdllib: libs.vhdl.gcc libgrt.a @@ -241,7 +251,7 @@ grt.links: fi libs.vhdl.local_gcc: ghdl_gcc$(EXEEXT) ghdl1-gcc$(EXEEXT) - $(MAKE) GHDL=$(PWD)/ghdl_gcc$(EXEEXT) ANALYZE_OPTS="--GHDL1=ghdl1-gcc$(EXEEXT)" STD_GHDL_FLAGS="--GHDL1=$(PWD)/ghdl1-gcc$(EXEEXT)" vhdl.libs.all libs.vhdl.standard + $(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 \ @@ -275,10 +285,10 @@ llvm-cbindings.o: $(srcdir)/src/ortho/$(llvm_be)/llvm-cbindings.cpp $(OPT_FLAGS) -o $@ $< libs.vhdl.llvmjit: ghdl_llvm_jit$(EXEEXT) - $(MAKE) GHDL=$(PWD)/ghdl_llvm_jit$(EXEEXT) vhdl.libs.all + $(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) GHDL=$(PWD)/ghdl_llvm$(EXEEXT) ANALYZE_OPTS="--GHDL1=ghdl1-llvm$(EXEEXT)" vhdl.libs.all libs.vhdl.standard + $(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 ghdl_llvm$(EXEEXT): version.ads force $(GNATMAKE) $(GHDL_LLVM_INCFLAGS) -aI$(srcdir)/src/ghdldrv $(GNATFLAGS)\ @@ -312,7 +322,7 @@ 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) GHDL=$(PWD)/ghdl_simul$(EXEEXT) vhdl.libs.all + $(MAKE) -f $(srcdir)/libraries/Makefile.inc $(LIBVHDL_FLAGS_TO_PASS) GHDL=$(PWD)/ghdl_simul$(EXEEXT) GHDL_FLAGS="" VHDLLIBS_COPY_OBJS=no vhdl.libs.all ################ mhdlsim (library for the vhdl part) #################### @@ -395,39 +405,10 @@ install.vpi: all.vpi install.dirs LIBSRC_DIR:=$(srcdir)/libraries LIBDST_DIR:=$(libdirsuffix) -ANALYZE_DEP:=ghdl_$(backend)$(EXEEXT) -GHDL=$(PWD)/$(ANALYZE_DEP) -ANALYZE_OPTS:= -ANALYZE:=$(GHDL) -a $(ANALYZE_OPTS) $(LIB_CFLAGS) - -# TODO?: don't include, make it separate -include $(srcdir)/libraries/Makefile.inc - -# TODO?: move std_standard in libraries/Makefile -ifeq "$(backend)" "gcc" - # ghdl with gcc backend is already installed, no need to specify ghdl1 - # (and we don't know where it is). - STD_GHDL_FLAGS= -else - # Specify ghdl1 path, as it is spawned by ghdl. - STD_GHDL_FLAGS=--GHDL1=$(PWD)/ghdl1-$(backend)$(EXEEXT) -endif - -$(LIB93_DIR)/std/std_standard.o: $(GHDL) std.v93 - cd $(LIB93_DIR)/std; \ - $(GHDL) --bootstrap-standard $(STD_GHDL_FLAGS) --std=93 $(LIB_CFLAGS) - -$(LIB87_DIR)/std/std_standard.o: $(GHDL) std.v87 - cd $(LIB87_DIR)/std; \ - $(GHDL) --bootstrap-standard $(STD_GHDL_FLAGS) --std=87 $(LIB_CFLAGS) - -$(LIB08_DIR)/std/std_standard.o: $(GHDL) std.v08 - cd $(LIB08_DIR)/std; \ - $(GHDL) --bootstrap-standard $(STD_GHDL_FLAGS) --std=08 $(LIB_CFLAGS) - -libs.vhdl.standard: $(LIB93_DIR)/std/std_standard.o \ - $(LIB87_DIR)/std/std_standard.o \ - $(LIB08_DIR)/std/std_standard.o +VHDLLIB_SUBDIRS= src/std src/ieee src/vital95 src/vital2000 src/synopsys src/mentor src/ieee2008 \ + v87/std v87/ieee v87/synopsys \ + v93/std v93/ieee v93/mentor v93/synopsys \ + v08/std v08/ieee v08/synopsys \ install.dirs: # Use -p to create parents and to avoid error if existing. @@ -456,7 +437,7 @@ install.vhdllib: install.dirs ####################### clean ############################################ clean: force - $(RM) -f *.o *.ali b~*.ad? *~ *.d b__*.ad? *.a *.so *.deps *.bexch version.* + $(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 run-bind.ad? grt.lst grt-files grt-files.in diff --git a/libraries/Makefile.inc b/libraries/Makefile.inc index bc6627a1f..15f316787 100644 --- a/libraries/Makefile.inc +++ b/libraries/Makefile.inc @@ -19,7 +19,8 @@ # Variable to be defined: # LIBSRC_DIR: path to the libraries sources # LIBDST_DIR: path to the build/destination dir. -# ANALYZE +# GHDL +# GHDL_FLAGS # LN # CP # MKDIR @@ -31,10 +32,8 @@ vhdl.libs.v93: std.v93 ieee.v93 synopsys.v93 mentor.v93 vhdl.libs.v87: std.v87 ieee.v87 synopsys.v87 vhdl.libs.v08: std.v08 ieee.v08 synopsys.v08 -VHDLLIB_SUBDIRS= src/std src/ieee src/vital95 src/vital2000 src/synopsys src/mentor src/ieee2008 \ - v87/std v87/ieee v87/synopsys \ - v93/std v93/ieee v93/mentor v93/synopsys \ - v08/std v08/ieee v08/synopsys \ +ANALYZE=$(GHDL) -a $(GHDL_FLAGS) +ANALYZE_DEP=$(GHDL) STD_SRCS := std/textio.vhdl std/textio_body.vhdl IEEE_SRCS := ieee/std_logic_1164.vhdl ieee/std_logic_1164_body.vhdl \ @@ -177,7 +176,7 @@ $(SYN87_DIR)/ieee-obj87.cf: $(ANALYZE_DEP) $(LIB87_DIR) $(SYNOPSYS87_SRCS) $(SYN for i in $(IEEE_SRCS) $(VITAL95_SRCS); do \ b=`basename $$i .vhdl`; \ if [ -f ../ieee/$$b.o ]; then \ - $(LN) ../ieee/$$b.o $$b.o || exit 1; \ + $(RM) -f $$b.o; $(LN) ../ieee/$$b.o $$b.o || exit 1; \ fi; \ done; \ for i in $(SYNOPSYS87_BSRCS); do \ @@ -237,7 +236,7 @@ $(SYN93_DIR)/ieee-obj93.cf: $(ANALYZE_DEP) $(LIB93_DIR) $(SYNOPSYS93_SRCS) $(SYN for i in $(IEEE_SRCS) $(MATH_SRCS) $(VITAL2000_SRCS); do \ b=`basename $$i .vhdl`; \ if [ -f ../ieee/$$b.o ]; then \ - $(LN) ../ieee/$$b.o $$b.o || exit 1; \ + $(RM) -f $$b.o; $(LN) ../ieee/$$b.o $$b.o || exit 1; \ fi; \ done; \ for i in $(SYNOPSYS93_BSRCS); do \ @@ -258,7 +257,7 @@ $(MENTOR93_DIR)/ieee-obj93.cf: $(ANALYZE_DEP) $(LIB93_DIR) $(MENTOR93_SRCS) $(ME for i in $(IEEE_SRCS) $(MATH_SRCS) $(VITAL2000_SRCS); do \ b=`basename $$i .vhdl`; \ if [ -f ../ieee/$$b.o ]; then \ - $(LN) ../ieee/$$b.o $$b.o || exit 1; \ + $(RM) -f $$b.o; $(LN) ../ieee/$$b.o $$b.o || exit 1; \ fi; \ done ; \ for i in $(MENTOR93_BSRCS); do \ @@ -320,10 +319,27 @@ $(SYN08_DIR)/ieee-obj08.cf: $(ANALYZE_DEP) $(LIB08_DIR) $(SYNOPSYS08_SRCS) $(SYN for i in $(IEEE08_SRCS) $(VITAL2000_SRCS); do \ b=`basename $$i .vhdl`; \ if [ -f ../ieee/$$b.o ]; then \ - $(LN) ../ieee/$$b.o $$b.o || exit 1; \ + $(RM) -f $$b.o; $(LN) ../ieee/$$b.o $$b.o || exit 1; \ fi; \ done; \ for i in $(SYNOPSYS08_BSRCS); do \ cmd="$(ANALYZE_IEEE08) ../../src/$$i"; \ echo $$cmd; eval $$cmd || exit 1; \ done + +############################################################################## + +ANALYZE_STD=$(GHDL) --bootstrap-standard $(GHDL_FLAGS) + +$(LIB93_DIR)/std/std_standard.o: $(GHDL) std.v93 + cd $(LIB93_DIR)/std; $(ANALYZE_STD) --std=93 + +$(LIB87_DIR)/std/std_standard.o: $(GHDL) std.v87 + cd $(LIB87_DIR)/std; $(ANALYZE_STD) --std=87 + +$(LIB08_DIR)/std/std_standard.o: $(GHDL) std.v08 + cd $(LIB08_DIR)/std; $(ANALYZE_STD) --std=08 + +libs.vhdl.standard: $(LIB93_DIR)/std/std_standard.o \ + $(LIB87_DIR)/std/std_standard.o \ + $(LIB08_DIR)/std/std_standard.o |