Skip to content

Commit

Permalink
Refactor: sanitizing touch on makefiles about to receive hardening
Browse files Browse the repository at this point in the history
* whitespace cleanup
* internally provided -D... and -I... switches belong to CPPFLAGS rather
  than CFLAGS
* use a following order of the per-target flags:
  - CPPFLAGS
  - YFLAGS
  - CFLAGS
  - LDFLAGS
  - LDADD/LIBADD
  - SOURCES

This is in part to reflect common conditional inclusion of additional
sources (which should preferably immediately follow the main SOURCES
definition) sometimes connected with extending other flags as well.
  • Loading branch information
jnpkrn committed Jun 22, 2016
1 parent 4e0d5c8 commit 9632cd7
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 121 deletions.
12 changes: 6 additions & 6 deletions attrd/Makefile.am
Expand Up @@ -17,16 +17,16 @@
#
include $(top_srcdir)/Makefile.common

halibdir = $(CRM_DAEMON_DIR)
halib_PROGRAMS = attrd
halibdir = $(CRM_DAEMON_DIR)
halib_PROGRAMS = attrd
## SOURCES

attrd_SOURCES =
attrd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \
$(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/cib/libcib.la \
attrd_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \
$(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/cib/libcib.la \
$(CLUSTERLIBS)

attrd_SOURCES =
if BUILD_ATOMIC_ATTRD
attrd_SOURCES += main.c commands.c
else
Expand Down
18 changes: 9 additions & 9 deletions cib/Makefile.am
Expand Up @@ -23,23 +23,23 @@ hadir = $(sysconfdir)/ha.d
halibdir = $(CRM_DAEMON_DIR)
commmoddir = $(halibdir)/modules/comm

COMMONLIBS = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/cib/libcib.la
COMMONLIBS = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/cib/libcib.la

## binary progs
halib_PROGRAMS = cib cibmon

## SOURCES
noinst_HEADERS = callbacks.h cibio.h cibmessages.h common.h notify.h
noinst_HEADERS = callbacks.h cibio.h cibmessages.h common.h notify.h

cib_SOURCES = io.c messages.c notify.c \
callbacks.c main.c remote.c common.c
cib_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \
$(COMMONLIBS) $(CRYPTOLIB) $(CLUSTERLIBS)

cib_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \
$(COMMONLIBS) $(CRYPTOLIB) $(CLUSTERLIBS)
cib_SOURCES = io.c messages.c notify.c \
callbacks.c main.c remote.c common.c

cibmon_SOURCES = cibmon.c
cibmon_LDADD = $(COMMONLIBS)
cibmon_LDADD = $(COMMONLIBS)
cibmon_SOURCES = cibmon.c

clean-generic:
rm -f *.log *.debug *.xml *~
Expand Down
31 changes: 15 additions & 16 deletions crmd/Makefile.am
Expand Up @@ -24,40 +24,39 @@ halib_PROGRAMS = crmd

## SOURCES

noinst_HEADERS = crmd.h crmd_fsa.h crmd_messages.h fsa_defines.h \
fsa_matrix.h fsa_proto.h crmd_utils.h crmd_callbacks.h \
noinst_HEADERS = crmd.h crmd_fsa.h crmd_messages.h fsa_defines.h \
fsa_matrix.h fsa_proto.h crmd_utils.h crmd_callbacks.h \
crmd_lrm.h te_callbacks.h tengine.h

crmd_SOURCES = main.c crmd.c corosync.c notify.c \
fsa.c control.c messages.c membership.c callbacks.c \
election.c join_client.c join_dc.c subsystems.c throttle.c \
cib.c pengine.c tengine.c lrm.c lrm_state.c remote_lrmd_ra.c \
utils.c misc.c te_events.c te_actions.c te_utils.c te_callbacks.c

if BUILD_HEARTBEAT_SUPPORT
crmd_SOURCES += heartbeat.c
endif

crmd_LDADD = $(top_builddir)/lib/fencing/libstonithd.la \
$(top_builddir)/lib/transition/libtransitioner.la \
$(top_builddir)/lib/pengine/libpe_rules.la \
$(top_builddir)/lib/cib/libcib.la \
$(top_builddir)/lib/cluster/libcrmcluster.la \
$(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/services/libcrmservice.la \
$(top_builddir)/lib/lrmd/liblrmd.la \
$(top_builddir)/lib/lrmd/liblrmd.la \
$(CLUSTERLIBS)

crmd_SOURCES = main.c crmd.c corosync.c notify.c \
fsa.c control.c messages.c membership.c callbacks.c \
election.c join_client.c join_dc.c subsystems.c throttle.c \
cib.c pengine.c tengine.c lrm.c lrm_state.c remote_lrmd_ra.c \
utils.c misc.c te_events.c te_actions.c te_utils.c te_callbacks.c
if BUILD_HEARTBEAT_SUPPORT
crmd_SOURCES += heartbeat.c
endif

if BUILD_XML_HELP
man7_MANS = crmd.7
man7_MANS = crmd.7
endif

graphs: fsa_inputs.png fsa_inputs_by_action.png fsa_actions_by_state.png
graphs: fsa_inputs.png fsa_inputs_by_action.png fsa_actions_by_state.png

%.png: %.dot
dot -Tpng $< > $@

%.dot : fsa_matrix.h make_dot.pl
%.dot: fsa_matrix.h make_dot.pl
perl $(top_srcdir)/crmd/make_dot.pl $(top_srcdir)/crmd/fsa_matrix.h $(top_builddir)/crmd

CLEANFILES = $(man7_MANS)
30 changes: 16 additions & 14 deletions fencing/Makefile.am
Expand Up @@ -24,13 +24,13 @@ test_SCRIPTS = regression.py
halibdir = $(CRM_DAEMON_DIR)
halib_PROGRAMS = stonithd stonith-test

sbin_PROGRAMS = stonith_admin
sbin_SCRIPTS = fence_legacy fence_pcmk
sbin_PROGRAMS = stonith_admin
sbin_SCRIPTS = fence_legacy fence_pcmk

noinst_HEADERS = internal.h
noinst_HEADERS = internal.h

if BUILD_XML_HELP
man7_MANS = stonithd.7
man7_MANS = stonithd.7
endif

stonith_test_SOURCES = test.c
Expand All @@ -49,23 +49,25 @@ stonith_admin_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/fencing/libstonithd.la \
$(CRYPTOLIB) $(CLUSTERLIBS)

stonithd_CFLAGS = -I$(top_srcdir)/pengine
stonithd_SOURCES = main.c commands.c remote.c
if BUILD_STONITH_CONFIG
BUILT_SOURCES = standalone_config.h

stonithd_SOURCES += standalone_config.c config.y config.l
stonithd_AM_LFLAGS = -o$(LEX_OUTPUT_ROOT).c
endif
stonithd_YFLAGS = -d
stonithd_CPPFLAGS = -I$(top_srcdir)/pengine $(AM_CPPFLAGS)
stonithd_YFLAGS = -d

stonithd_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/cluster/libcrmcluster.la \
$(top_builddir)/lib/fencing/libstonithd.la \
$(top_builddir)/lib/pengine/libpe_status.la \
$(top_builddir)/pengine/libpengine.la \
$(top_builddir)/pengine/libpengine.la \
$(CRYPTOLIB) $(CLUSTERLIBS)

stonithd_SOURCES = main.c commands.c remote.c

if BUILD_STONITH_CONFIG
BUILT_SOURCES = standalone_config.h

stonithd_SOURCES += standalone_config.c config.y config.l
stonithd_AM_LFLAGS = -o$(LEX_OUTPUT_ROOT).c
endif

# lex/yacc issues:
CFLAGS = $(CFLAGS_COPY:-Werror=)

Expand Down
9 changes: 5 additions & 4 deletions lib/cib/Makefile.am
Expand Up @@ -18,15 +18,16 @@
include $(top_srcdir)/Makefile.common

## libraries
lib_LTLIBRARIES = libcib.la
lib_LTLIBRARIES = libcib.la

## SOURCES
libcib_la_SOURCES = cib_ops.c cib_utils.c cib_client.c cib_native.c cib_attrs.c
libcib_la_SOURCES += cib_file.c cib_remote.c
libcib_la_SOURCES += cib_file.c cib_remote.c

libcib_la_LDFLAGS = -version-info 5:1:1
libcib_la_LIBADD = $(CRYPTOLIB) $(top_builddir)/lib/pengine/libpe_rules.la $(top_builddir)/lib/common/libcrmcommon.la
libcib_la_CFLAGS = -I$(top_srcdir)
libcib_la_CPPFLAGS = -I$(top_srcdir) $(AM_CPPFLAGS)

libcib_la_LIBADD = $(CRYPTOLIB) $(top_builddir)/lib/pengine/libpe_rules.la $(top_builddir)/lib/common/libcrmcommon.la

clean-generic:
rm -f *.log *.debug *.xml *~
3 changes: 1 addition & 2 deletions lib/cluster/Makefile.am
Expand Up @@ -20,10 +20,10 @@ include $(top_srcdir)/Makefile.common
## libraries
lib_LTLIBRARIES = libcrmcluster.la

libcrmcluster_la_SOURCES = election.c cluster.c membership.c
libcrmcluster_la_LDFLAGS = -version-info 6:0:2
libcrmcluster_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la $(top_builddir)/lib/fencing/libstonithd.la $(CLUSTERLIBS)

libcrmcluster_la_SOURCES = election.c cluster.c membership.c
if BUILD_CS_SUPPORT
libcrmcluster_la_SOURCES += cpg.c
if BUILD_CS_PLUGIN
Expand All @@ -32,7 +32,6 @@ else
libcrmcluster_la_SOURCES += corosync.c
endif
endif

if BUILD_HEARTBEAT_SUPPORT
libcrmcluster_la_SOURCES += heartbeat.c
#libcrmcluster_la_LIBADD += -ldl
Expand Down
8 changes: 4 additions & 4 deletions lib/common/Makefile.am
Expand Up @@ -31,16 +31,16 @@ lib_LTLIBRARIES = libcrmcommon.la

CFLAGS = $(CFLAGS_COPY:-Wcast-qual=) -fPIC

libcrmcommon_la_LDFLAGS = -version-info 9:0:6
libcrmcommon_la_LIBADD = @LIBADD_DL@ $(GNUTLSLIBS) -lm

libcrmcommon_la_SOURCES = compat.c digest.c ipc.c io.c procfs.c utils.c xml.c \
iso8601.c remote.c mainloop.c logging.c watchdog.c \
xpath.c
if BUILD_CIBSECRETS
libcrmcommon_la_SOURCES += cib_secrets.c
endif

libcrmcommon_la_LDFLAGS = -version-info 9:0:6
libcrmcommon_la_LIBADD = @LIBADD_DL@ $(GNUTLSLIBS) -lm
libcrmcommon_la_SOURCES += $(top_builddir)/lib/gnu/md5.c
libcrmcommon_la_SOURCES += $(top_builddir)/lib/gnu/md5.c

clean-generic:
rm -f *.log *.debug *.xml *~
8 changes: 4 additions & 4 deletions lib/fencing/Makefile.am
Expand Up @@ -18,8 +18,8 @@
#
include $(top_srcdir)/Makefile.common

lib_LTLIBRARIES = libstonithd.la
lib_LTLIBRARIES = libstonithd.la

libstonithd_la_SOURCES = st_client.c
libstonithd_la_LDFLAGS = -version-info 4:1:2
libstonithd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
libstonithd_la_LDFLAGS = -version-info 4:1:2
libstonithd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
libstonithd_la_SOURCES = st_client.c
10 changes: 5 additions & 5 deletions lib/lrmd/Makefile.am
Expand Up @@ -16,10 +16,10 @@
#
include $(top_srcdir)/Makefile.common

lib_LTLIBRARIES = liblrmd.la
lib_LTLIBRARIES = liblrmd.la

liblrmd_la_SOURCES = lrmd_client.c proxy_common.c
liblrmd_la_LDFLAGS = -version-info 4:0:3
liblrmd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/services/libcrmservice.la \
liblrmd_la_LDFLAGS = -version-info 4:0:3
liblrmd_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la \
$(top_builddir)/lib/services/libcrmservice.la \
$(top_builddir)/lib/fencing/libstonithd.la
liblrmd_la_SOURCES = lrmd_client.c proxy_common.c
12 changes: 6 additions & 6 deletions lib/pengine/Makefile.am
Expand Up @@ -18,19 +18,19 @@
include $(top_srcdir)/Makefile.common

## libraries
lib_LTLIBRARIES = libpe_rules.la libpe_status.la
lib_LTLIBRARIES = libpe_rules.la libpe_status.la

## SOURCES
noinst_HEADERS = unpack.h variant.h
noinst_HEADERS = unpack.h variant.h

libpe_rules_la_LDFLAGS = -version-info 2:6:0
libpe_rules_la_SOURCES = rules.c common.c
libpe_rules_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
libpe_rules_la_SOURCES = rules.c common.c

libpe_status_la_LDFLAGS = -version-info 11:0:1
libpe_status_la_SOURCES = status.c unpack.c utils.c complex.c native.c \
group.c clone.c rules.c common.c remote.c
libpe_status_la_LIBADD = @CURSESLIBS@ $(top_builddir)/lib/common/libcrmcommon.la
libpe_status_la_LIBADD = @CURSESLIBS@ $(top_builddir)/lib/common/libcrmcommon.la
libpe_status_la_SOURCES = status.c unpack.c utils.c complex.c native.c \
group.c clone.c rules.c common.c remote.c

clean-generic:
rm -f *.log *.debug *~
24 changes: 12 additions & 12 deletions lib/services/Makefile.am
Expand Up @@ -18,24 +18,24 @@

MAINTAINERCLEANFILES = Makefile.in

AM_CPPFLAGS = -I$(top_builddir)/include
AM_CPPFLAGS = -I$(top_builddir)/include

lib_LTLIBRARIES = libcrmservice.la
noinst_HEADERS = upstart.h systemd.h services_private.h
lib_LTLIBRARIES = libcrmservice.la
noinst_HEADERS = upstart.h systemd.h services_private.h

libcrmservice_la_SOURCES = services.c services_linux.c
libcrmservice_la_LDFLAGS = -version-info 4:1:1
libcrmservice_la_CFLAGS = $(GIO_CFLAGS) -DOCF_ROOT_DIR=\"@OCF_ROOT_DIR@\"
libcrmservice_la_LIBADD = $(GIO_LIBS) $(top_builddir)/lib/common/libcrmcommon.la $(DBUS_LIBS)
libcrmservice_la_LDFLAGS = -version-info 4:1:1
libcrmservice_la_CPPFLAGS = -DOCF_ROOT_DIR=\"@OCF_ROOT_DIR@\" $(AM_CPPFLAGS)
libcrmservice_la_CFLAGS = $(GIO_CFLAGS)

libcrmservice_la_LIBADD = $(GIO_LIBS) $(top_builddir)/lib/common/libcrmcommon.la $(DBUS_LIBS)

libcrmservice_la_SOURCES = services.c services_linux.c
if BUILD_DBUS
libcrmservice_la_SOURCES += dbus.c
libcrmservice_la_SOURCES += dbus.c
endif

if BUILD_UPSTART
libcrmservice_la_SOURCES += upstart.c
libcrmservice_la_SOURCES += upstart.c
endif

if BUILD_SYSTEMD
libcrmservice_la_SOURCES += systemd.c
libcrmservice_la_SOURCES += systemd.c
endif
9 changes: 5 additions & 4 deletions lib/transition/Makefile.am
Expand Up @@ -18,14 +18,15 @@
include $(top_srcdir)/Makefile.common

## libraries
lib_LTLIBRARIES = libtransitioner.la
lib_LTLIBRARIES = libtransitioner.la

## SOURCES
libtransitioner_la_SOURCES = unpack.c graph.c utils.c

libtransitioner_la_LDFLAGS = -version-info 2:5:0
libtransitioner_la_CFLAGS = -I$(top_builddir)
libtransitioner_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
libtransitioner_la_CPPFLAGS = -I$(top_builddir) $(AM_CPPFLAGS)

libtransitioner_la_LIBADD = $(top_builddir)/lib/common/libcrmcommon.la
libtransitioner_la_SOURCES = unpack.c graph.c utils.c

clean-generic:
rm -f *~

0 comments on commit 9632cd7

Please sign in to comment.