]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
automake: idiomatically mark test libraries as convenience libraries
authorRoss Burton <ross.burton@arm.com>
Fri, 3 Dec 2021 15:38:27 +0000 (08:38 -0700)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 3 Dec 2021 15:38:34 +0000 (08:38 -0700)
Instead of installing then deleting, mark the libraries which are only
used at build time and should not be installed as noinst, so they don't
get installed at all.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit 1932bd3c46fc5f3532d6583ccc2ccd4c8d8530a2)

src/Makefile.am
src/tools/Makefile.am
src/tools/cgset.c

index 30feb6135f5fba4cf8cf40a21d35c30da0306456..26e32238880f3a07195303cc0b01a198fdddbe13 100644 (file)
@@ -14,20 +14,17 @@ AM_YFLAGS = -d
 CLEANFILES = lex.c parse.c parse.h
 
 AM_CPPFLAGS = -I$(top_srcdir)/include
-lib_LTLIBRARIES = libcgroup.la libcgroupfortesting.la
+
+lib_LTLIBRARIES = libcgroup.la
 libcgroup_la_SOURCES = parse.h parse.y lex.l api.c config.c libcgroup-internal.h libcgroup.map wrapper.c log.c
 libcgroup_la_LIBADD = -lpthread $(CODE_COVERAGE_LIBS)
 libcgroup_la_CFLAGS = $(CODE_COVERAGE_CFLAGS) -DSTATIC=static
 libcgroup_la_LDFLAGS = -Wl,--version-script,$(srcdir)/libcgroup.map \
        -version-number $(LIBRARY_VERSION_MAJOR):$(LIBRARY_VERSION_MINOR):$(LIBRARY_VERSION_RELEASE)
 
+noinst_LTLIBRARIES = libcgroupfortesting.la
 libcgroupfortesting_la_SOURCES = $(libcgroup_la_SOURCES)
 libcgroupfortesting_la_LIBADD = -lpthread $(CODE_COVERAGE_LIBS)
 libcgroupfortesting_la_CFLAGS = $(CODE_COVERAGE_CFLAGS) -DSTATIC= -DUNIT_TEST
 libcgroupfortesting_la_LDFLAGS = -Wl,--version-script,$(top_srcdir)/tests/gunit/libcgroup_unittest.map \
        -version-number $(LIBRARY_VERSION_MAJOR):$(LIBRARY_VERSION_MINOR):$(LIBRARY_VERSION_RELEASE)
-
-install-exec-hook:
-       find $(DESTDIR)$(libdir) -type f -name libcgroupfortesting.\* -delete
-       unlink $(DESTDIR)$(libdir)/libcgroupfortesting.so
-       unlink $(DESTDIR)$(libdir)/libcgroupfortesting.so.$(LIBRARY_VERSION_MAJOR)
index bf76157373ca0d453f634f468d65b1f312ea4baa..40608873227cf699fa43602d1924392fa0cbad0b 100644 (file)
@@ -10,7 +10,7 @@ bin_PROGRAMS = cgexec cgclassify cgcreate cgset cgget cgdelete lssubsys\
 
 sbin_PROGRAMS = cgconfigparser cgclear
 
-lib_LTLIBRARIES = libcgset.la
+noinst_LTLIBRARIES = libcgset.la
 
 cgexec_SOURCES = cgexec.c tools-common.c tools-common.h
 cgexec_LIBS = $(CODE_COVERAGE_LIBS)
@@ -63,8 +63,5 @@ cgsnapshot_CFLAGS = $(CODE_COVERAGE_CFLAGS)
 
 install-exec-hook:
        chmod u+s $(DESTDIR)$(bindir)/cgexec
-       find $(DESTDIR)$(libdir) -type f -name libcgset.\* -delete
-       unlink $(DESTDIR)$(libdir)/libcgset.so
-       unlink $(DESTDIR)$(libdir)/libcgset.so.0
 
 endif
index fca08d83f453b3bdd36e03fbc6d43605b71c8f15..a59e1d3287169583bef96e1abd9e9cc558e40311 100644 (file)
@@ -16,6 +16,7 @@ enum {
        COPY_FROM_OPTION = CHAR_MAX + 1
 };
 
+#ifndef UNIT_TEST
 static struct option const long_options[] =
 {
        {"rule", required_argument, NULL, 'r'},
@@ -72,6 +73,7 @@ static void usage(int status, const char *program_name)
        printf("  --copy-from <source_cgroup_path>      Control group whose "\
                "parameters will be copied\n");
 }
+#endif /* !UNIT_TEST */
 
 STATIC int parse_r_flag(const char * const program_name,
                        const char * const name_value_str,
@@ -124,6 +126,7 @@ err:
        return ret;
 }
 
+#ifndef UNIT_TEST
 int main(int argc, char *argv[])
 {
        int ret = 0;
@@ -278,3 +281,4 @@ err:
        free(name_value);
        return ret;
 }
+#endif /* !UNIT_TEST */