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
CC := @CC@
CXX := @CXX@
-CFLAGS += @CFLAGS@ -DPREFIX=\"$(prefix)\"
+CFLAGS += @CFLAGS@ -DPREFIX=\"$(prefix)\" -Werror
CPPFLAGS += @CPPFLAGS@
-CXXFLAGS += @CXXFLAGS@ -DPREFIX=\"$(prefix)\"
+CXXFLAGS += @CXXFLAGS@ -DPREFIX=\"$(prefix)\" -Werror
COMPILE := $(CXX) -fPIC -MMD -MP $(CPPFLAGS) $(CXXFLAGS) \
$(sprojs_include)
COMPILE_C := $(CC) -fPIC -MMD -MP $(CPPFLAGS) $(CFLAGS) \
INSTALL_EXE := $(INSTALL) -m 555
STOW := @stow@
+# Tests
+bintests = tests/gdbserver.py \
+ tests/ebreak.py
+
#-------------------------------------------------------------------------
# Include subproject makefile fragments
#-------------------------------------------------------------------------
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
# 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
+
+check : check-cpp check-bin
.PHONY : check
$(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) && \
# 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