1#
2#  Copyright 2021 Northern.tech AS
3#
4#  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5#
6#  This program is free software; you can redistribute it and/or modify it
7#  under the terms of the GNU General Public License as published by the
8#  Free Software Foundation; version 3.
9#
10#  This program is distributed in the hope that it will be useful,
11#  but WITHOUT ANY WARRANTY; without even the implied warranty of
12#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13#  GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
18#
19# To the extent this program is licensed as part of the Enterprise
20# versions of CFEngine, the applicable Commercial Open Source License
21# (COSL) may apply to this file if you as a licensee so wish it. See
22# included file COSL.txt.
23#
24if !BUILTIN_EXTENSIONS
25projlib_LTLIBRARIES = libpromises.la
26AM_LDFLAGS = -version-info 3:6:0 -no-undefined
27else
28noinst_LTLIBRARIES = libpromises.la
29AM_LDFLAGS =
30endif
31
32AM_LDFLAGS += $(CORE_LDFLAGS) $(LMDB_LDFLAGS) $(TOKYOCABINET_LDFLAGS) $(QDBM_LDFLAGS) \
33	$(PCRE_LDFLAGS) $(OPENSSL_LDFLAGS) $(SQLITE3_LDFLAGS) $(LIBACL_LDFLAGS) $(LIBYAML_LDFLAGS) $(LIBCURL_LDFLAGS)
34
35AM_CPPFLAGS = \
36	-I$(srcdir)/../libntech/libutils -I$(srcdir)/../libcfnet \
37	-I$(srcdir)/../libenv \
38	-I$(srcdir)/../cf-check \
39	$(CORE_CPPFLAGS) $(ENTERPRISE_CPPFLAGS) \
40	$(LMDB_CPPFLAGS) $(TOKYOCABINET_CPPFLAGS) $(QDBM_CPPFLAGS) \
41	$(PCRE_CPPFLAGS) $(OPENSSL_CPPFLAGS) $(SQLITE3_CPPFLAGS) $(LIBACL_CPPFLAGS) $(LIBYAML_CPPFLAGS) $(LIBCURL_CPPFLAGS)
42
43AM_CFLAGS = $(CORE_CFLAGS) $(ENTERPRISE_CFLAGS) \
44	$(LMDB_CFLAGS) $(TOKYOCABINET_CFLAGS) $(QDBM_CFLAGS) \
45	$(PCRE_CFLAGS) $(OPENSSL_CFLAGS) $(SQLITE3_CFLAGS) $(LIBACL_CFLAGS) $(LIBYAML_CFLAGS) $(LIBCURL_CFLAGS)
46
47AM_YFLAGS = -d
48
49LIBS = $(LMDB_LIBS) $(TOKYOCABINET_LIBS) $(QDBM_LIBS) \
50	$(PCRE_LIBS) $(OPENSSL_LIBS) $(SQLITE3_LIBS) $(LIBACL_LIBS) $(LIBYAML_LIBS) $(LIBCURL_LIBS)
51
52# The lib providing sd_listen_fds() is not needed in libpromises, it's actually
53# needed in libcfnet. But adding it here is an easy way to make sure it's
54# available for all the binaries that might need it. Once libcfnet doesn't
55# require libpromises, we can do this properly.
56LIBS += $(SYSTEMD_SOCKET_LIBS)
57
58libpromises_la_LIBADD = ../libntech/libutils/libutils.la ../libcfnet/libcfnet.la \
59	../libenv/libenv.la $(ENTERPRISE_LDADD)
60
61libpromises_la_SOURCES = \
62	acl_tools.h acl_tools_posix.c \
63	actuator.c actuator.h \
64	assoc.c assoc.h \
65	attributes.c attributes.h \
66	audit.c audit.h \
67	bootstrap.c bootstrap.h bootstrap.inc failsafe.cf \
68	cf-windows-functions.h \
69	cf3.defs.h \
70	cf3.extern.h \
71	cf3globals.c \
72	cf3lex.l \
73	cf3parse.y cf3parse.h \
74	cf3parse_logic.h \
75	changes_chroot.c changes_chroot.h \
76	chflags.c chflags.h \
77	class.c class.h \
78	cmdb.c cmdb.h \
79	constants.c \
80	conversion.c conversion.h \
81	crypto.c crypto.h \
82	dbm_api.c dbm_api.h dbm_api_types.h dbm_priv.h \
83	dbm_migration.c dbm_migration.h \
84	dbm_migration_lastseen.c \
85	dbm_lmdb.c \
86	dbm_quick.c \
87	dbm_tokyocab.c \
88	enterprise_stubs.c enterprise_extension.c enterprise_extension.h \
89	eval_context.c eval_context.h \
90	evalfunction.c evalfunction.h \
91	exec_tools.c exec_tools.h \
92	expand.c expand.h \
93	extensions.c extensions.h \
94	extensions_template.c.pre extensions_template.h.pre \
95	feature.c feature.h \
96	files_copy.c files_copy.h \
97	files_interfaces.c files_interfaces.h \
98	files_lib.c files_lib.h \
99	files_links.c files_links.h \
100	files_names.c files_names.h \
101	files_operators.c files_operators.h \
102	files_repository.c files_repository.h \
103	fncall.c fncall.h \
104	generic_agent.c generic_agent.h \
105	global_mutex.c global_mutex.h \
106	granules.c granules.h \
107	instrumentation.c instrumentation.h \
108	item_lib.c item_lib.h \
109	iteration.c iteration.h \
110	keyring.c keyring.h \
111	lastseen.c lastseen.h \
112	loading.c loading.h \
113	locks.c locks.h \
114	logic_expressions.c logic_expressions.h \
115	matching.c matching.h \
116	match_scope.c match_scope.h \
117	math_eval.c math_eval.h math.pc \
118	mod_access.c mod_access.h \
119	mod_common.c mod_common.h \
120	mod_custom.c mod_custom.h \
121	mod_databases.c mod_databases.h \
122	mod_environ.c mod_environ.h \
123	mod_exec.c mod_exec.h \
124	mod_files.c mod_files.h \
125	mod_measurement.c mod_measurement.h \
126	mod_methods.c mod_methods.h \
127	mod_outputs.c mod_outputs.h \
128	mod_packages.c mod_packages.h \
129	mod_process.c mod_process.h \
130	mod_report.c mod_report.h \
131	mod_services.c mod_services.h \
132	mod_storage.c mod_storage.h \
133	mod_knowledge.c mod_knowledge.h \
134	mod_users.c mod_users.h \
135	modes.c \
136	monitoring_read.c monitoring_read.h \
137	ornaments.c ornaments.h \
138	policy.c policy.h \
139	parser.c parser.h \
140	parser_helpers.h \
141	parser_state.h \
142	patches.c \
143	pipes.h pipes.c \
144	processes_select.c processes_select.h \
145	process_lib.h process_unix_priv.h \
146	promises.c promises.h \
147	prototypes3.h \
148	rlist.c rlist.h \
149	scope.c scope.h \
150	shared_lib.c shared_lib.h \
151	signals.c signals.h \
152	sort.c sort.h \
153	storage_tools.c \
154	string_expressions.c string_expressions.h \
155	syntax.c syntax.h \
156	syslog_client.c syslog_client.h \
157	systype.c systype.h \
158	timeout.c timeout.h \
159	unix.c unix.h \
160	var_expressions.c var_expressions.h \
161	variable.c variable.h \
162	vars.c vars.h \
163	verify_classes.c verify_classes.h \
164	verify_reports.c \
165	verify_vars.c verify_vars.h \
166	../cf-check/backup.c ../cf-check/backup.h \
167	../cf-check/diagnose.c ../cf-check/diagnose.h \
168	../cf-check/lmdump.c ../cf-check/lmdump.h \
169	../cf-check/repair.c ../cf-check/repair.h \
170	../cf-check/replicate_lmdb.c ../cf-check/replicate_lmdb.h \
171	../cf-check/utilities.c ../cf-check/utilities.h \
172	../cf-check/validate.c ../cf-check/validate.h
173
174if !NT
175
176libpromises_la_SOURCES += \
177	process_unix.c \
178	pipes_unix.c
179
180if LINUX
181libpromises_la_SOURCES += \
182	process_linux.c
183endif
184
185if AIX
186libpromises_la_SOURCES += \
187	process_aix.c
188endif
189
190if HPUX
191libpromises_la_SOURCES += \
192	process_hpux.c
193endif
194
195if SOLARIS
196libpromises_la_SOURCES += \
197	process_solaris.c
198endif
199
200if FREEBSD
201libpromises_la_SOURCES += \
202	process_freebsd.c
203endif
204
205if !LINUX
206if !AIX
207if !HPUX
208if !SOLARIS
209if !FREEBSD
210libpromises_la_SOURCES += \
211	process_unix_stub.c
212endif
213endif
214endif
215endif
216endif
217
218endif # !NT
219
220
221########## Sources pre-generated and distributed in the tarball ##########
222# Make sure you include the generated file as a dependency to a target
223# (e.g. libpromises_la) so that it's generated during "make dist"
224
225BUILT_SOURCES = cf3lex.c cf3parse.h cf3parse.c \
226	enterprise_extension.c enterprise_extension.h \
227	bootstrap.inc
228EXTRA_SCRIPTS = text2cstring.pl enterprise_extension.sed
229EXTRA_DIST = $(EXTRA_SCRIPTS)
230
231enterprise_extension.c: extensions_template.c.pre enterprise_extension.sed
232	$(V_SED) $(SED) -f $(srcdir)/enterprise_extension.sed $< > $@
233enterprise_extension.h: extensions_template.h.pre enterprise_extension.sed
234	$(V_SED) $(SED) -f $(srcdir)/enterprise_extension.sed $< > $@
235
236bootstrap.inc: failsafe.cf text2cstring.pl
237	$(V_PERL) $(PERL) $(srcdir)/text2cstring.pl $< > $@
238
239
240#
241# Proper compilation progress printing
242#
243V_PERL = $(cf__v_PERL_$(V))
244cf__v_PERL_ = $(cf__v_PERL_$(AM_DEFAULT_VERBOSITY))
245cf__v_PERL_0 = @echo "  PERL    " "$@";
246cf__v_PERL_1 =
247V_SED = $(cf__v_SED_$(V))
248cf__v_SED_ = $(cf__v_SED_$(AM_DEFAULT_VERBOSITY))
249cf__v_SED_0 = @echo "  SED     " "$@";
250cf__v_SED_1 =
251
252
253#
254# Some basic clean ups
255#
256# Use "make mostlyclean" if you want to keep the BUILT_SOURCES
257#
258CLEANFILES = $(BUILT_SOURCES)
259MOSTLYCLEANFILES =  *.gcno *.gcda *~ *.orig *.rej
260