diff options
Diffstat (limited to 'makefiles/Makefile.top')
-rw-r--r-- | makefiles/Makefile.top | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top index 9d3c680..c1a8490 100644 --- a/makefiles/Makefile.top +++ b/makefiles/Makefile.top @@ -48,6 +48,7 @@ # test Build and run test suite, using current settings. # coverage Determine test suite coverage (requires lcov) # profile Build with profiling support enabled (requires gprof) +# sanitize Build and run test suite, using ASAN and UBSAN # docs Produce documentation (requires doxygen) # dist Produce release tarball from latest git tag # clean Clean the build @@ -123,6 +124,8 @@ else ifeq ($(MAKECMDGOALS),profile) WANT_TEST := yes else ifeq ($(MAKECMDGOALS),coverage) WANT_TEST := yes +else ifeq ($(MAKECMDGOALS),sanitize) + WANT_TEST := yes else WANT_TEST := no endif @@ -186,9 +189,17 @@ endif # Determine the output filename ifeq ($(findstring lib,$(COMPONENT_TYPE)),lib) ifeq ($(findstring lib-shared,$(COMPONENT_TYPE)),lib-shared) - SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) - SONAME := $(SHAREDLIBNAME).$(major-version) - OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION) + ifeq ($(findstring darwin,$(HOST)),darwin) + # In macOS, shared lib filenames are of the form libfoo.dylib, + # libfoo.1.dylib, or libfoo.1.2.3.dylib + SONAME := lib$(COMPONENT).$(major-version)$(LIBEXT) + SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) + OUTPUT := $(BUILDDIR)/lib$(COMPONENT).$(COMPONENT_VERSION)$(LIBEXT) + else + SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT) + SONAME := $(SHAREDLIBNAME).$(major-version) + OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION) + endif else OUTPUT := $(BUILDDIR)/lib$(COMPONENT)$(LIBEXT) endif @@ -205,10 +216,6 @@ endif ifeq ($(COMPONENT_TYPE),lib-shared) POST_TARGETS := __postshared $(POST_TARGETS) - -__postshared: - $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SONAME) - $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SHAREDLIBNAME) endif # Default target @@ -218,6 +225,10 @@ all: $(PRE_TARGETS) $(OUTPUT) $(POST_TARGETS) test: all $(TEST_PREREQS) $(TEST_BINARIES) $(TEST_TARGETS) $(VQ)$(ECHO) $(ECHOFLAGS) " TEST: Testing complete" +__postshared: + $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SONAME) + $(Q)$(LN) $(LNFLAGS) -f -s $(notdir $(OUTPUT)) $(BUILDDIR)/$(SHAREDLIBNAME) + # Compute coverage __precov: __partial_clean $(Q)$(LCOV) --directory . --zerocounters @@ -231,6 +242,9 @@ coverage: __precov test $(Q)$(GENHTML) -o $(COVERAGEDIR) --num-spaces 2 \ $(COVERAGEDIR)/$(COMPONENT).info +# Build and test sanitizers +sanitize: test + # Build for profiling profile: __partial_clean test @@ -408,6 +422,16 @@ else endif endif +ifneq ($(PRE_TARGETS),) +# Ensure that PRE_TARGETS are built before OBJECTS. +$(OBJECTS): $(PRE_TARGETS) +endif + +ifneq ($(POST_TARGETS),) +# Ensure that POST_TARGETS are built after OBJECTS. +$(POST_TARGETS): $(OBJECTS) +endif + ############################################################################### # Autogenerated, implied rules ############################################################################### |