diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2012-08-17 19:14:36 -0700 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-05-12 14:15:13 +0200 |
commit | eeca6e0f05ce59361e6084deab6117c240520cdb (patch) | |
tree | 8b10de98be8bb21ae36459ef9db2d526edfdd64f /plugins | |
parent | 332c6ef2c7480a23f3c2fa59f5cd2c88db8d9919 (diff) | |
download | monitoring-plugins-eeca6e0f05ce59361e6084deab6117c240520cdb.tar.gz |
build: fix building with parallel make.
By using a more automake-style handling of dependencies and a single
convenience library, it's tremendously easy to build in parallel.
Note that since the linking happens with the static archives, the
unused objects are discarded and provide no overhead whatsoever.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Makefile.am | 95 |
1 files changed, 24 insertions, 71 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 0eb0255b..64969dbf 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am | |||
@@ -39,15 +39,19 @@ EXTRA_PROGRAMS = check_mysql check_radius check_pgsql check_snmp check_hpjd \ | |||
39 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ | 39 | check_nagios check_by_ssh check_dns check_nt check_ide_smart \ |
40 | check_procs check_mysql_query check_apt check_dbi | 40 | check_procs check_mysql_query check_apt check_dbi |
41 | 41 | ||
42 | EXTRA_DIST = t tests utils.c netutils.c sslutils.c popen.c utils.h netutils.h \ | 42 | EXTRA_DIST = t tests |
43 | popen.h common.h runcmd.c runcmd.h | ||
44 | 43 | ||
45 | PLUGINHDRS = common.h | 44 | PLUGINHDRS = common.h |
46 | 45 | ||
47 | BASEOBJS = utils.o ../lib/libnagiosplug.a ../gl/libgnu.a | 46 | noinst_LIBRARIES = libnpcommon.a |
48 | NETOBJS = netutils.o $(BASEOBJS) $(EXTRA_NETOBJS) | 47 | |
49 | SSLOBJS = sslutils.o | 48 | libnpcommon_a_SOURCES = utils.c netutils.c sslutils.c runcmd.c \ |
49 | popen.c utils.h netutils.h popen.h common.h runcmd.c runcmd.h | ||
50 | |||
51 | BASEOBJS = libnpcommon.a ../lib/libnagiosplug.a ../gl/libgnu.a | ||
52 | NETOBJS = $(BASEOBJS) $(EXTRA_NETOBLS) | ||
50 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) | 53 | NETLIBS = $(NETOBJS) $(SOCKETLIBS) |
54 | SSLOBJS = $(BASEOBJS) $(NETLIBS) $(SSLLIBS) | ||
51 | 55 | ||
52 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) | 56 | TESTS_ENVIRONMENT = perl -I $(top_builddir) -I $(top_srcdir) |
53 | 57 | ||
@@ -62,19 +66,19 @@ test-debug: | |||
62 | ############################################################################## | 66 | ############################################################################## |
63 | # the actual targets | 67 | # the actual targets |
64 | 68 | ||
65 | check_apt_LDADD = $(BASEOBJS) runcmd.o | 69 | check_apt_LDADD = $(BASEOBJS) |
66 | check_cluster_LDADD = $(BASEOBJS) | 70 | check_cluster_LDADD = $(BASEOBJS) |
67 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) | 71 | check_dbi_LDADD = $(NETLIBS) $(DBILIBS) |
68 | check_dig_LDADD = $(NETLIBS) runcmd.o | 72 | check_dig_LDADD = $(NETLIBS) |
69 | check_disk_LDADD = $(BASEOBJS) popen.o | 73 | check_disk_LDADD = $(BASEOBJS) |
70 | check_dns_LDADD = $(NETLIBS) runcmd.o | 74 | check_dns_LDADD = $(NETLIBS) |
71 | check_dummy_LDADD = $(BASEOBJS) | 75 | check_dummy_LDADD = $(BASEOBJS) |
72 | check_fping_LDADD = $(NETLIBS) popen.o | 76 | check_fping_LDADD = $(NETLIBS) |
73 | check_game_LDADD = $(BASEOBJS) runcmd.o | 77 | check_game_LDADD = $(BASEOBJS) |
74 | check_http_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | 78 | check_http_LDADD = $(SSLOBJS) |
75 | check_hpjd_LDADD = $(NETLIBS) popen.o | 79 | check_hpjd_LDADD = $(NETLIBS) |
76 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) | 80 | check_ldap_LDADD = $(NETLIBS) $(LDAPLIBS) |
77 | check_load_LDADD = $(BASEOBJS) popen.o | 81 | check_load_LDADD = $(BASEOBJS) |
78 | check_mrtg_LDADD = $(BASEOBJS) | 82 | check_mrtg_LDADD = $(BASEOBJS) |
79 | check_mrtgtraf_LDADD = $(BASEOBJS) | 83 | check_mrtgtraf_LDADD = $(BASEOBJS) |
80 | check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"' | 84 | check_mysql_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"' |
@@ -83,22 +87,22 @@ check_mysql_LDADD = $(NETLIBS) $(MYSQLLIBS) | |||
83 | check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"' | 87 | check_mysql_query_CFLAGS = $(MYSQLCFLAGS) -DNP_VERSION='"$(NP_VERSION)"' |
84 | check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE) | 88 | check_mysql_query_CPPFLAGS = $(MYSQLINCLUDE) |
85 | check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS) | 89 | check_mysql_query_LDADD = $(NETLIBS) $(MYSQLLIBS) |
86 | check_nagios_LDADD = $(BASEOBJS) runcmd.o | 90 | check_nagios_LDADD = $(BASEOBJS) |
87 | check_nt_LDADD = $(NETLIBS) | 91 | check_nt_LDADD = $(NETLIBS) |
88 | check_ntp_LDADD = $(NETLIBS) $(MATHLIBS) | 92 | check_ntp_LDADD = $(NETLIBS) $(MATHLIBS) |
89 | check_ntp_peer_LDADD = $(NETLIBS) $(MATHLIBS) | 93 | check_ntp_peer_LDADD = $(NETLIBS) $(MATHLIBS) |
90 | check_nwstat_LDADD = $(NETLIBS) | 94 | check_nwstat_LDADD = $(NETLIBS) |
91 | check_overcr_LDADD = $(NETLIBS) | 95 | check_overcr_LDADD = $(NETLIBS) |
92 | check_pgsql_LDADD = $(NETLIBS) $(PGLIBS) | 96 | check_pgsql_LDADD = $(NETLIBS) $(PGLIBS) |
93 | check_ping_LDADD = $(NETLIBS) popen.o | 97 | check_ping_LDADD = $(NETLIBS) |
94 | check_procs_LDADD = $(BASEOBJS) | 98 | check_procs_LDADD = $(BASEOBJS) |
95 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) | 99 | check_radius_LDADD = $(NETLIBS) $(RADIUSLIBS) |
96 | check_real_LDADD = $(NETLIBS) | 100 | check_real_LDADD = $(NETLIBS) |
97 | check_snmp_LDADD = $(BASEOBJS) | 101 | check_snmp_LDADD = $(BASEOBJS) |
98 | check_smtp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | 102 | check_smtp_LDADD = $(SSLOBJS) |
99 | check_ssh_LDADD = $(NETLIBS) | 103 | check_ssh_LDADD = $(NETLIBS) |
100 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) popen.o | 104 | check_swap_LDADD = $(MATHLIBS) $(BASEOBJS) |
101 | check_tcp_LDADD = $(SSLOBJS) $(NETLIBS) $(SSLLIBS) | 105 | check_tcp_LDADD = $(SSLOBJS) |
102 | check_time_LDADD = $(NETLIBS) | 106 | check_time_LDADD = $(NETLIBS) |
103 | check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS) | 107 | check_ntp_time_LDADD = $(NETLIBS) $(MATHLIBS) |
104 | check_ups_LDADD = $(NETLIBS) | 108 | check_ups_LDADD = $(NETLIBS) |
@@ -106,62 +110,11 @@ check_users_LDADD = $(BASEOBJS) | |||
106 | check_by_ssh_LDADD = $(NETLIBS) | 110 | check_by_ssh_LDADD = $(NETLIBS) |
107 | check_ide_smart_LDADD = $(BASEOBJS) | 111 | check_ide_smart_LDADD = $(BASEOBJS) |
108 | negate_LDADD = $(BASEOBJS) | 112 | negate_LDADD = $(BASEOBJS) |
109 | urlize_LDADD = $(BASEOBJS) popen.o | 113 | urlize_LDADD = $(BASEOBJS) |
110 | |||
111 | check_apt_DEPENDENCIES = check_apt.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
112 | check_cluster_DEPENDENCIES = check_cluster.c $(BASEOBJS) $(DEPLIBS) | ||
113 | check_dbi_DEPENDENCIES = check_dbi.c $(NETOBJS) $(DEPLIBS) | ||
114 | check_dig_DEPENDENCIES = check_dig.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
115 | check_disk_DEPENDENCIES = check_disk.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
116 | check_dns_DEPENDENCIES = check_dns.c $(NETOBJS) runcmd.o $(DEPLIBS) | ||
117 | check_dummy_DEPENDENCIES = check_dummy.c $(DEPLIBS) | ||
118 | check_fping_DEPENDENCIES = check_fping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
119 | check_game_DEPENDENCIES = check_game.c $(DEPLIBS) runcmd.o | ||
120 | check_http_DEPENDENCIES = check_http.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
121 | check_hpjd_DEPENDENCIES = check_hpjd.c $(NETOBJS) popen.o $(DEPLIBS) | ||
122 | check_ide_smart_DEPENDENCIES = check_ide_smart.c $(BASEOBJS) $(DEPLIBS) | ||
123 | check_ldap_DEPENDENCIES = check_ldap.c $(NETOBJS) $(DEPLIBS) | ||
124 | check_load_DEPENDENCIES = check_load.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
125 | check_mrtg_DEPENDENCIES = check_mrtg.c $(DEPLIBS) | ||
126 | check_mrtgtraf_DEPENDENCIES = check_mrtgtraf.c $(DEPLIBS) | ||
127 | check_mysql_DEPENDENCIES = check_mysql.c $(NETOBJS) $(DEPLIBS) | ||
128 | check_mysql_query_DEPENDENCIES = check_mysql_query.c $(NETOBJS) $(DEPLIBS) | ||
129 | check_nagios_DEPENDENCIES = check_nagios.c $(BASEOBJS) runcmd.o $(DEPLIBS) | ||
130 | check_nt_DEPENDENCIES = check_nt.c $(NETOBJS) $(DEPLIBS) | ||
131 | check_ntp_DEPENDENCIES = check_ntp.c $(NETOBJS) $(DEPLIBS) | ||
132 | check_ntp_peer_DEPENDENCIES = check_ntp_peer.c $(NETOBJS) $(DEPLIBS) | ||
133 | check_nwstat_DEPENDENCIES = check_nwstat.c $(NETOBJS) $(DEPLIBS) | ||
134 | check_overcr_DEPENDENCIES = check_overcr.c $(NETOBJS) $(DEPLIBS) | ||
135 | check_pgsql_DEPENDENCIES = check_pgsql.c $(NETOBJS) $(DEPLIBS) | ||
136 | check_ping_DEPENDENCIES = check_ping.c $(NETOBJS) popen.o $(DEPLIBS) | ||
137 | check_procs_DEPENDENCIES = check_procs.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
138 | check_radius_DEPENDENCIES = check_radius.c $(NETOBJS) $(DEPLIBS) | ||
139 | check_real_DEPENDENCIES = check_real.c $(NETOBJS) $(DEPLIBS) | ||
140 | check_snmp_DEPENDENCIES = check_snmp.c $(BASEOBJS) $(DEPLIBS) | ||
141 | check_smtp_DEPENDENCIES = check_smtp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
142 | check_ssh_DEPENDENCIES = check_ssh.c $(NETOBJS) $(DEPLIBS) | ||
143 | check_swap_DEPENDENCIES = check_swap.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
144 | check_tcp_DEPENDENCIES = check_tcp.c $(SSLOBJS) $(NETOBJS) $(DEPLIBS) | ||
145 | check_time_DEPENDENCIES = check_time.c $(NETOBJS) $(DEPLIBS) | ||
146 | check_ntp_time_DEPENDENCIES = check_ntp_time.c $(NETOBJS) $(DEPLIBS) | ||
147 | check_ups_DEPENDENCIES = check_ups.c $(NETOBJS) $(DEPLIBS) | ||
148 | check_users_DEPENDENCIES = check_users.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
149 | check_by_ssh_DEPENDENCIES = check_by_ssh.c $(NETOBJS) $(DEPLIBS) | ||
150 | negate_DEPENDENCIES = negate.c $(BASEOBJS) $(DEPLIBS) | ||
151 | urlize_DEPENDENCIES = urlize.c $(BASEOBJS) popen.o $(DEPLIBS) | ||
152 | 114 | ||
153 | ############################################################################## | 115 | ############################################################################## |
154 | # secondary dependencies | 116 | # secondary dependencies |
155 | 117 | ||
156 | popen.o: popen.c popen.h $(PLUGINHDRS) | ||
157 | |||
158 | runcmd.o: runcmd.c runcmd.h $(PLUGINHDRS) | ||
159 | |||
160 | utils.o: utils.c utils.h $(PLUGINHDRS) | ||
161 | |||
162 | netutils.o: netutils.c netutils.h $(PLUGINHDRS) | ||
163 | sslutils.o: sslutils.c netutils.h $(PLUGINHDRS) | ||
164 | |||
165 | all-local: $(check_tcp_programs) | 118 | all-local: $(check_tcp_programs) |
166 | 119 | ||
167 | $(check_tcp_programs): check_tcp | 120 | $(check_tcp_programs): check_tcp |