diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2016-03-15 12:47:13 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2016-03-15 19:15:25 +0100 |
commit | 3b8361eb0635e2a56f8db11823d0b5837f1bb6de (patch) | |
tree | 197abc191bd4d69bb5ee9ed473386208c3aca1ca /src | |
parent | 3bac0a17f5187aa22d433470146875cac15944bf (diff) | |
download | ModemManager-3b8361eb0635e2a56f8db11823d0b5837f1bb6de.tar.gz |
build,core: update build rules
We try to combine in common envvars the compiler and linker flags shared by the
different components, and where possible, also re-using the implicit AM_CFLAGS
and AM_LDFLAGS variables that automake provides, and which apply to all objects
being built in the same Makefile.am.
The internal libmodem-helpers.la library is also renamed to libhelpers.la
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 211 | ||||
-rw-r--r-- | src/tests/Makefile.am | 203 |
2 files changed, 152 insertions, 262 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 2afcd9af7..1bd99281e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,31 +1,72 @@ -SUBDIRS=. tests -udevrulesdir = $(UDEV_BASE_DIR)/rules.d -udevrules_DATA = \ - 77-mm-usb-device-blacklist.rules \ - 77-mm-pcmcia-device-blacklist.rules \ - 77-mm-platform-serial-whitelist.rules \ - 77-mm-usb-serial-adapters-greylist.rules \ - 80-mm-candidate.rules +SUBDIRS = . tests -AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) -AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) +################################################################################ +# common +################################################################################ -noinst_LTLIBRARIES = libmodem-helpers.la libport.la +sbin_PROGRAMS = +noinst_LTLIBRARIES = +EXTRA_DIST = +BUILT_SOURCES = +CLEANFILES = -libmodem_helpers_la_CPPFLAGS = \ +AM_CFLAGS = \ $(MM_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) \ + $(GUDEV_CFLAGS) \ -I$(top_srcdir) \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ + -I$(top_srcdir)/libqcdm/src \ -I$(top_srcdir)/libmm-glib \ - -I${top_srcdir}/libmm-glib/generated \ - -I${top_builddir}/libmm-glib/generated + -I${top_builddir}/libmm-glib/generated \ + -I${top_builddir}/libmm-glib/generated/tests \ + $(NULL) + +AM_LDFLAGS = \ + $(MM_LIBS) \ + $(CODE_COVERAGE_LDFLAGS) \ + $(GUDEV_LIBS) \ + $(NULL) + +if WITH_QMI +AM_CFLAGS += $(QMI_CFLAGS) +AM_LDFLAGS += $(QMI_LIBS) +endif -libmodem_helpers_la_LIBADD = \ - $(top_builddir)/libmm-glib/libmm-glib.la +if WITH_MBIM +AM_CFLAGS += $(MBIM_CFLAGS) +AM_LDFLAGS += $(MBIM_LIBS) +endif + +if WITH_POLKIT +AM_CFLAGS += $(POLKIT_CFLAGS) +AM_LDFLAGS += $(POLKIT_LIBS) +endif -libmodem_helpers_la_SOURCES = \ +################################################################################ +# generic udev rules +################################################################################ + +udevrulesdir = $(UDEV_BASE_DIR)/rules.d +udevrules_DATA = \ + 77-mm-usb-device-blacklist.rules \ + 77-mm-pcmcia-device-blacklist.rules \ + 77-mm-platform-serial-whitelist.rules \ + 77-mm-usb-serial-adapters-greylist.rules \ + 80-mm-candidate.rules \ + $(NULL) + +EXTRA_DIST += $(udevrules_DATA) + +################################################################################ +# helpers library +################################################################################ + +noinst_LTLIBRARIES += libhelpers.la + +libhelpers_la_SOURCES = \ mm-error-helpers.c \ mm-error-helpers.h \ mm-modem-helpers.c \ @@ -39,52 +80,46 @@ libmodem_helpers_la_SOURCES = \ mm-sms-part-cdma.h \ mm-sms-part-cdma.c -# Additional QMI support in libmodem-helpers if WITH_QMI -libmodem_helpers_la_SOURCES += \ +libhelpers_la_SOURCES += \ mm-modem-helpers-qmi.c \ mm-modem-helpers-qmi.h -libmodem_helpers_la_CPPFLAGS += $(QMI_CFLAGS) endif -# Additional MBIM support in libmodem-helpers if WITH_MBIM -libmodem_helpers_la_SOURCES += \ +libhelpers_la_SOURCES += \ mm-modem-helpers-mbim.c \ mm-modem-helpers-mbim.h -libmodem_helpers_la_CPPFLAGS += $(MBIM_CFLAGS) endif -# libport specific enum types -PORT_ENUMS = \ +################################################################################ +# ports library +################################################################################ + +noinst_LTLIBRARIES += libport.la + +PORT_ENUMS_INPUTS = \ $(srcdir)/mm-port.h \ - $(srcdir)/mm-port-serial-at.h + $(srcdir)/mm-port-serial-at.h \ + $(NULL) + +PORT_ENUMS_GENERATED = \ + mm-port-enums-types.h \ + mm-port-enums-types.c \ + $(NULL) -mm-port-enums-types.h: Makefile.am $(PORT_ENUMS) $(top_srcdir)/build-aux/mm-enums-template.h +mm-port-enums-types.h: Makefile.am $(PORT_ENUMS_INPUTS) $(top_srcdir)/build-aux/mm-enums-template.h $(AM_V_GEN) $(GLIB_MKENUMS) \ --fhead "#include \"mm-port.h\"\n#include \"mm-port-serial-at.h\"\n#ifndef __MM_PORT_ENUMS_TYPES_H__\n#define __MM_PORT_ENUMS_TYPES_H__\n" \ --template $(top_srcdir)/build-aux/mm-enums-template.h \ --ftail "#endif /* __MM_PORT_ENUMS_TYPES_H__ */\n" \ - $(PORT_ENUMS) > $@ + $(PORT_ENUMS_INPUTS) > $@ mm-port-enums-types.c: Makefile.am $(top_srcdir)/build-aux/mm-enums-template.c mm-port-enums-types.h $(AM_V_GEN) $(GLIB_MKENUMS) \ --fhead "#include \"mm-port-enums-types.h\"" \ --template $(top_srcdir)/build-aux/mm-enums-template.c \ - $(PORT_ENUMS) > $@ - -libport_la_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I${top_srcdir}/libmm-glib/generated \ - -I${top_builddir}/libmm-glib/generated - -nodist_libport_la_SOURCES = \ - mm-port-enums-types.h \ - mm-port-enums-types.c + $(PORT_ENUMS_INPUTS) > $@ libport_la_SOURCES = \ mm-port.c \ @@ -100,67 +135,73 @@ libport_la_SOURCES = \ mm-serial-parsers.c \ mm-serial-parsers.h -# Additional QMI support in libserial +nodist_libport_la_SOURCES = $(PORT_ENUMS_GENERATED) + if WITH_QMI libport_la_SOURCES += \ mm-port-qmi.c \ mm-port-qmi.h -libport_la_CPPFLAGS += $(QMI_CFLAGS) endif -# Additional MBIM support in libserial if WITH_MBIM libport_la_SOURCES += \ mm-port-mbim.c \ mm-port-mbim.h -libport_la_CPPFLAGS += $(MBIM_CFLAGS) endif -# Daemon specific enum types -DAEMON_ENUMS = \ +libport_la_LIBADD = \ + $(top_builddir)/libqcdm/src/libqcdm.la \ + $(top_builddir)/libmm-glib/libmm-glib.la \ + $(builddir)/libhelpers.la \ + $(NULL) + +# Request to build enum types before anything else +BUILT_SOURCES += $(PORT_ENUMS_GENERATED) +CLEANFILES += $(PORT_ENUMS_GENERATED) + +################################################################################ +# ModemManager daemon +################################################################################ + +sbin_PROGRAMS += ModemManager + +DAEMON_ENUMS_INPUTS = \ $(srcdir)/mm-base-bearer.h \ - $(srcdir)/mm-port-probe.h + $(srcdir)/mm-port-probe.h \ + $(NULL) -mm-daemon-enums-types.h: Makefile.am $(DAEMON_ENUMS) $(top_srcdir)/build-aux/mm-enums-template.h +DAEMON_ENUMS_GENERATED = \ + mm-daemon-enums-types.h \ + mm-daemon-enums-types.c \ + $(NULL) + +mm-daemon-enums-types.h: Makefile.am $(DAEMON_ENUMS_INPUTS) $(top_srcdir)/build-aux/mm-enums-template.h $(AM_V_GEN) $(GLIB_MKENUMS) \ --fhead "#include \"mm-base-bearer.h\"\n#include \"mm-port-probe.h\"\n#ifndef __MM_DAEMON_ENUMS_TYPES_H__\n#define __MM_DAEMON_ENUMS_TYPES_H__\n" \ --template $(top_srcdir)/build-aux/mm-enums-template.h \ --ftail "#endif /* __MM_DAEMON_ENUMS_TYPES_H__ */\n" \ - $(DAEMON_ENUMS) > $@ + $(DAEMON_ENUMS_INPUTS) > $@ mm-daemon-enums-types.c: Makefile.am $(top_srcdir)/build-aux/mm-enums-template.c mm-daemon-enums-types.h $(AM_V_GEN) $(GLIB_MKENUMS) \ --fhead "#include \"mm-daemon-enums-types.h\"" \ --template $(top_srcdir)/build-aux/mm-enums-template.c \ - $(DAEMON_ENUMS) > $@ + $(DAEMON_ENUMS_INPUTS) > $@ -sbin_PROGRAMS = ModemManager +# Request to build enum types before anything else +BUILT_SOURCES += $(DAEMON_ENUMS_GENERATED) +CLEANFILES += $(DAEMON_ENUMS_GENERATED) ModemManager_CPPFLAGS = \ - $(MM_CFLAGS) \ - $(GUDEV_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_builddir)/libmm-glib \ - -I${top_srcdir}/libmm-glib/generated \ - -I${top_builddir}/libmm-glib/generated \ - -I${top_srcdir}/libmm-glib/generated/tests \ - -I${top_builddir}/libmm-glib/generated/tests \ -DPLUGINDIR=\"$(pkglibdir)\" ModemManager_LDADD = \ - $(MM_LIBS) \ - $(GUDEV_LIBS) \ - $(builddir)/libmodem-helpers.la \ - $(builddir)/libport.la \ $(top_builddir)/libqcdm/src/libqcdm.la \ - $(top_builddir)/libmm-glib/generated/tests/libmm-test-generated.la - -nodist_ModemManager_SOURCES = \ - mm-daemon-enums-types.h \ - mm-daemon-enums-types.c + $(top_builddir)/libmm-glib/libmm-glib.la \ + $(top_builddir)/libmm-glib/generated/tests/libmm-test-generated.la \ + $(builddir)/libhelpers.la \ + $(builddir)/libport.la \ + $(NULL) ModemManager_SOURCES = \ main.c \ @@ -234,13 +275,11 @@ ModemManager_SOURCES = \ mm-plugin.c \ mm-plugin.h +nodist_ModemManager_SOURCES = $(DAEMON_ENUMS_GENERATED) + # Additional Polkit support if WITH_POLKIT -ModemManager_SOURCES += \ - mm-auth-provider-polkit.c \ - mm-auth-provider-polkit.h -ModemManager_LDADD += $(POLKIT_LIBS) -ModemManager_CPPFLAGS += $(POLKIT_CFLAGS) +ModemManager_SOURCES += mm-auth-provider-polkit.h mm-auth-provider-polkit.c endif # Additional suspend/resume support via systemd @@ -264,8 +303,6 @@ ModemManager_SOURCES += \ mm-bearer-qmi.c \ mm-broadband-modem-qmi.h \ mm-broadband-modem-qmi.c -ModemManager_CPPFLAGS += $(QMI_CFLAGS) -ModemManager_LDADD += $(QMI_LIBS) endif # Additional MBIM support in ModemManager @@ -279,18 +316,4 @@ ModemManager_SOURCES += \ mm-bearer-mbim.c \ mm-broadband-modem-mbim.h \ mm-broadband-modem-mbim.c -ModemManager_CPPFLAGS += $(MBIM_CFLAGS) -ModemManager_LDADD += $(MBIM_LIBS) endif - -EXTRA_DIST = \ - $(udevrules_DATA) - -# Request to build enum types before anything else -BUILT_SOURCES = \ - mm-daemon-enums-types.h \ - mm-daemon-enums-types.c \ - mm-port-enums-types.h \ - mm-port-enums-types.c - -CLEANFILES = $(BUILT_SOURCES) diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 0804b14f5..53b174563 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -1,190 +1,57 @@ -include $(top_srcdir)/gtester.make - -AM_CFLAGS = $(CODE_COVERAGE_CFLAGS) -AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS) - -noinst_PROGRAMS = \ - test-modem-helpers \ - test-charsets \ - test-qcdm-serial-port \ - test-at-serial-port \ - test-sms-part-3gpp \ - test-sms-part-cdma - -if WITH_QMI -noinst_PROGRAMS += test-modem-helpers-qmi -endif - -TEST_PROGS += $(noinst_PROGRAMS) - -################ - -test_modem_helpers_SOURCES = \ - test-modem-helpers.c - -test_modem_helpers_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated - -test_modem_helpers_LDADD = \ - $(top_builddir)/src/libmodem-helpers.la \ - $(MM_LIBS) - -if WITH_QMI -test_modem_helpers_CPPFLAGS += $(QMI_CFLAGS) -test_modem_helpers_LDADD += $(QMI_LIBS) -endif - -################ - -if WITH_QMI -test_modem_helpers_qmi_SOURCES = \ - test-modem-helpers-qmi.c - -test_modem_helpers_qmi_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated \ - $(QMI_CFLAGS) - -test_modem_helpers_qmi_LDADD = \ - $(top_builddir)/src/libmodem-helpers.la \ - $(MM_LIBS) \ - $(QMI_LIBS) -endif - -################ - -test_charsets_SOURCES = \ - test-charsets.c - -test_charsets_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated - -test_charsets_LDADD = \ - $(top_builddir)/src/libmodem-helpers.la \ - $(MM_LIBS) - -if WITH_QMI -test_charsets_CPPFLAGS += $(QMI_CFLAGS) -test_charsets_LDADD += $(QMI_LIBS) -endif -################ +include $(top_srcdir)/gtester.make -test_qcdm_serial_port_SOURCES = \ - test-qcdm-serial-port.c +################################################################################ +# common +################################################################################ -test_qcdm_serial_port_CPPFLAGS = \ +AM_CFLAGS = \ $(MM_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) \ -I$(top_srcdir) \ - -I$(top_srcdir)/src \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ + -I$(top_srcdir)/libqcdm/src \ -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated + -I${top_builddir}/libmm-glib/generated \ + -I${top_srcdir}/src/ \ + -I${top_builddir}/src/ \ + $(NULL) -test_qcdm_serial_port_LDADD = \ +AM_LDFLAGS = \ $(MM_LIBS) \ + $(CODE_COVERAGE_LDFLAGS) \ + $(top_builddir)/src/libhelpers.la \ $(top_builddir)/src/libport.la \ - $(top_builddir)/src/libmodem-helpers.la \ - $(top_builddir)/libqcdm/src/libqcdm.la \ - -lutil + -lutil \ + $(NULL) if WITH_QMI -test_qcdm_serial_port_CPPFLAGS += $(QMI_CFLAGS) -test_qcdm_serial_port_LDADD += $(QMI_LIBS) +AM_CFLAGS += $(QMI_CFLAGS) +AM_LDFLAGS += $(QMI_LIBS) endif -################ - -test_at_serial_port_SOURCES = \ - test-at-serial-port.c - -test_at_serial_port_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated - -test_at_serial_port_LDADD = \ - $(MM_LIBS) \ - $(top_builddir)/src/libport.la \ - $(top_builddir)/src/libmodem-helpers.la \ - -lutil - -if WITH_QMI -test_at_serial_port_CPPFLAGS += $(QMI_CFLAGS) -test_at_serial_port_LDADD += $(QMI_LIBS) +if WITH_MBIM +AM_CFLAGS += $(MBIM_CFLAGS) +AM_LDFLAGS += $(MBIM_LIBS) endif -################ - -test_sms_part_3gpp_SOURCES = \ - test-sms-part-3gpp.c +################################################################################ +# tests +# note: we abuse AM_LDFLAGS to include libhelpers and libport. +################################################################################ -test_sms_part_3gpp_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated - -test_sms_part_3gpp_LDADD = \ - $(top_builddir)/src/libmodem-helpers.la \ - $(MM_LIBS) +noinst_PROGRAMS = \ + test-modem-helpers \ + test-charsets \ + test-qcdm-serial-port \ + test-at-serial-port \ + test-sms-part-3gpp \ + test-sms-part-cdma \ + $(NULL) if WITH_QMI -test_sms_part_3gpp_CPPFLAGS += $(QMI_CFLAGS) -test_sms_part_3gpp_LDADD += $(QMI_LIBS) +noinst_PROGRAMS += test-modem-helpers-qmi endif -################ - -test_sms_part_cdma_SOURCES = \ - test-sms-part-cdma.c - -test_sms_part_cdma_CPPFLAGS = \ - $(MM_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/include \ - -I$(top_srcdir)/libmm-glib \ - -I$(top_srcdir)/libmm-glib/generated \ - -I$(top_builddir)/libmm-glib/generated - -test_sms_part_cdma_LDADD = \ - $(top_builddir)/src/libmodem-helpers.la \ - $(MM_LIBS) - -if WITH_QMI -test_sms_part_cdma_CPPFLAGS += $(QMI_CFLAGS) -test_sms_part_cdma_LDADD += $(QMI_LIBS) -endif +TEST_PROGS += $(noinst_PROGRAMS) |