X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=Makefile.in;h=c09fc505881b393afd7ac1f34b03a513d7ab50f6;hb=96218b1cdc0cd395d150e7db08a1b84ea1ae1543;hp=5ae226f90ed2319d114bb7e3fed3b00186980f36;hpb=3fd738af16ef977f1aa507e2525bb4c16fff9026;p=riscv-isa-sim.git diff --git a/Makefile.in b/Makefile.in index 5ae226f..c09fc50 100644 --- a/Makefile.in +++ b/Makefile.in @@ -55,14 +55,14 @@ enable_stow := @enable_stow@ ifeq ($(enable_stow),yes) stow_pkg_dir := $(prefix)/pkgs - DESTDIR ?= $(stow_pkg_dir)/$(project_name)-$(project_ver) + INSTALLDIR ?= $(DESTDIR)$(stow_pkg_dir)/$(project_name)-$(project_ver) else - DESTDIR ?= $(prefix) + INSTALLDIR ?= $(DESTDIR)$(prefix) endif -install_hdrs_dir := $(DESTDIR)/include/$(project_name) -install_libs_dir := $(DESTDIR)/lib -install_exes_dir := $(DESTDIR)/bin +install_hdrs_dir := $(INSTALLDIR)/include/$(project_name) +install_libs_dir := $(INSTALLDIR)/lib +install_exes_dir := $(INSTALLDIR)/bin #------------------------------------------------------------------------- # List of subprojects @@ -71,7 +71,7 @@ install_exes_dir := $(DESTDIR)/bin sprojs := @subprojects@ sprojs_enabled := @subprojects_enabled@ -sprojs_include := -I. $(addprefix -I$(src_dir)/, $(sprojs_enabled)) +sprojs_include := -I. -I$(src_dir) $(addprefix -I$(src_dir)/, $(sprojs_enabled)) VPATH := $(addprefix $(src_dir)/, $(sprojs_enabled)) #------------------------------------------------------------------------- @@ -120,6 +120,9 @@ INSTALL_LIB := $(INSTALL) -m 644 INSTALL_EXE := $(INSTALL) -m 555 STOW := @stow@ +# Tests +bintests = $(src_dir)/tests/ebreak.py + #------------------------------------------------------------------------- # Include subproject makefile fragments #------------------------------------------------------------------------- @@ -188,18 +191,18 @@ $(2)_pch := $$(patsubst %.h, %.h.gch, $$($(2)_precompiled_hdrs)) $(2)_objs := $$(patsubst %.cc, %.o, $$($(2)_srcs)) $(2)_c_objs := $$(patsubst %.c, %.o, $$($(2)_c_srcs)) $(2)_deps := $$(patsubst %.o, %.d, $$($(2)_objs)) -$(2)_c_deps := $$(patsubst %.o, %.d, $$($(2)_c_objs)) -$(2)_pch_deps := $$(patsubst %.h, %.d, $$($(2)_precompiled_hdrs)) +$(2)_deps += $$(patsubst %.o, %.d, $$($(2)_c_objs)) +$(2)_deps += $$(patsubst %.h, %.h.d, $$($(2)_precompiled_hdrs)) $$($(2)_pch) : %.h.gch : %.h - $(COMPILE) $$< + $(COMPILE) -x c++-header $$< -o $$@ # If using clang, don't depend (and thus don't build) precompiled headers $$($(2)_objs) : %.o : %.cc $$($(2)_gen_hdrs) $(if $(filter-out clang,$(CC)),$$($(2)_pch)) $(COMPILE) -c $$< $$($(2)_c_objs) : %.o : %.c $$($(2)_gen_hdrs) $(COMPILE_C) -c $$< -$(2)_junk += $$(addprefix $(src_dir)/$(1)/, $$($(2)_pch)) \ - $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) $$($(2)_c_deps) $$($(2)_gen_hdrs) $$($(2)_pch_deps) +$(2)_junk += $$($(2)_pch) $$($(2)_objs) $$($(2)_c_objs) $$($(2)_deps) \ + $$($(2)_gen_hdrs) # Reverse the dependency list so that a given subproject only depends on # subprojects listed to its right. This is the correct order for linking @@ -307,6 +310,7 @@ test_outs += $$($(2)_test_outs) install_hdrs += $$(addprefix $(src_dir)/$(1)/, $$($(2)_hdrs)) $$($(2)_gen_hdrs) install_libs += lib$(1).so install_exes += $$($(2)_install_prog_exes) +install_pcs += riscv-$(1).pc endef @@ -328,8 +332,20 @@ deps : $(deps) # Check #------------------------------------------------------------------------- -check : $(test_outs) - echo; grep -h -e'Unit Tests' -e'FAILED' -e'Segementation' $^; echo +bintest_outs = $(bintests:=.out) +junk += $(bintest_outs) +%.out: % all + ./$* < /dev/null 2>&1 | tee $@ + +check-cpp : $(test_outs) + @echo + ! grep -h -e'Unit Tests' -e'FAILED' -e'Segmentation' $^ < /dev/null + @echo + +check-bin : $(bintest_outs) + ! tail -n 1 $^ < /dev/null 2>&1 | grep FAILED + +check : check-cpp check-bin .PHONY : check @@ -337,7 +353,7 @@ check : $(test_outs) # Installation #------------------------------------------------------------------------- -install-hdrs : $(install_hdrs) +install-hdrs : $(install_hdrs) config.h $(MKINSTALLDIRS) $(install_hdrs_dir) for file in $^; \ do \ @@ -358,7 +374,14 @@ install-exes : $(install_exes) $(INSTALL_EXE) $$file $(install_exes_dir); \ done -install : install-hdrs install-libs install-exes +install-pc : $(install_pcs) + $(MKINSTALLDIRS) $(install_libs_dir)/pkgconfig/ + for file in $^; \ + do \ + $(INSTALL_HDR) $$file $(install_libs_dir)/pkgconfig/; \ + done + +install : install-hdrs install-libs install-exes install-pc ifeq ($(enable_stow),yes) $(MKINSTALLDIRS) $(stow_pkg_dir) cd $(stow_pkg_dir) && \ @@ -372,15 +395,6 @@ endif # Regenerate configure information #------------------------------------------------------------------------- -configure_prereq = \ - $(src_dir)/configure.ac \ - $(src_dir)/aclocal.m4 \ - $(join $(addprefix $(src_dir)/, $(sprojs_enabled)), \ - $(patsubst %, /%.ac, $(sprojs_enabled))) - -$(src_dir)/configure : $(configure_prereq) - cd $(src_dir) && autoconf && autoheader - config.status : $(src_dir)/configure ./config.status --recheck