Makefiles: combined the rules for local libraries

This commit is contained in:
Nikos Mavrogiannopoulos
2016-04-16 10:13:22 +02:00
parent 3b844bf3f0
commit b088d2df73
6 changed files with 50 additions and 72 deletions

View File

@@ -1,6 +1,8 @@
SUBDIRS = ccan common
AM_CPPFLAGS = -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \
include common.mk
AM_CPPFLAGS += -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \
-I$(srcdir)/ -I$(builddir)/../ -I$(srcdir)/../ $(LIBOPTS_CFLAGS) \
$(LIBGNUTLS_CFLAGS) -I$(srcdir)/common -I$(builddir)/common \
$(LIBPROTOBUF_C_CFLAGS) $(LIBLZ4_CFLAGS) \
@@ -11,25 +13,9 @@ AM_CPPFLAGS = -I$(srcdir)/../gl/ -I$(builddir)/../gl/ \
BUILT_SOURCES = ocserv-args.c ocserv-args.h ipc.pb-c.c ipc.pb-c.h \
http-heads.h kkdcp_asn1_tab.c ctl.pb-c.c ctl.pb-c.h
if LOCAL_TALLOC
AM_CPPFLAGS += -I$(top_srcdir)/src/ccan/talloc
endif
#AM_CPPFLAGS += -DDEBUG_LEAKS
include common.mk
EXTRA_DIST = version.inc.in version.inc \
ipc.proto ctl.proto http-heads.gperf common.mk ocserv-fw
if LOCAL_HTTP_PARSER
AM_CPPFLAGS += -I$(srcdir)/http-parser/
HTTP_PARSER_SOURCES = http-parser/http_parser.c http-parser/http_parser.h
NEEDED_HTTP_PARSER_LIBS =
else
NEEDED_HTTP_PARSER_LIBS = $(HTTP_PARSER_LIBS)
endif
sbin_PROGRAMS = ocserv
bin_SCRIPTS = ocserv-fw
@@ -72,16 +58,21 @@ ocserv_SOURCES += lzs.c lzs.h
endif
if HAVE_GSSAPI
ocserv_SOURCES += kkdcp_asn1_tab.c kkdcp.asn
ocserv_SOURCES += kkdcp_asn1_tab.c kkdcp.asn
endif
if LOCAL_HTTP_PARSER
HTTP_PARSER_SOURCES = http-parser/http_parser.c http-parser/http_parser.h
endif
ocserv_LDFLAGS =
ocserv_LDADD = ../gl/libgnu.a $(NEEDED_LIBOPTS) libcmd-ocserv.a ccan/libccan.a common/libcommon.a
ocserv_LDADD += $(LIBGNUTLS_LIBS) $(PAM_LIBS) $(LIBUTIL) \
$(LIBSECCOMP) $(LIBWRAP) $(LIBCRYPT) $(NEEDED_HTTP_PARSER_LIBS) \
$(LIBPROTOBUF_C_LIBS) $(LIBSYSTEMD) $(LIBTALLOC_LIBS) \
$(NEEDED_LIBPROTOBUF_LIBS) $(LIBSYSTEMD) $(LIBTALLOC_LIBS) \
$(RADCLI_LIBS) $(LIBLZ4_LIBS) $(LIBKRB5_LIBS) \
$(LIBTASN1_LIBS) $(LIBOATH_LIBS) $(LIBNETTLE_LIBS) \
$(LIBEV_LIBS) libipc.a
$(LIBEV_LIBS) libipc.a $(NEEDED_LIBPROTOBUF_LIBS)
if PCL
@@ -94,8 +85,6 @@ endif
if LOCAL_PROTOBUF_C
SUBDIRS += protobuf
AM_CPPFLAGS += -I$(srcdir)/protobuf/
ocserv_LDADD += protobuf/libprotobuf.a
endif
SUBDIRS += occtl ocpasswd

View File

@@ -1,9 +1,25 @@
AM_CPPFLAGS =
if NEED_LIBOPTS
NEEDED_LIBOPTS = ../libopts/libopts.a
NEEDED_LIBOPTS2 = ../../libopts/libopts.a
NEEDED_LIBOPTS = $(top_srcdir)/libopts/libopts.a
else
NEEDED_LIBOPTS = $(LIBOPTS_LDADD)
NEEDED_LIBOPTS2 = $(LIBOPTS_LDADD)
endif
if LOCAL_TALLOC
AM_CPPFLAGS += -I$(top_srcdir)/src/ccan/talloc
endif
if LOCAL_HTTP_PARSER
AM_CPPFLAGS += -I$(top_srcdir)/src/http-parser/
NEEDED_HTTP_PARSER_LIBS =
else
NEEDED_HTTP_PARSER_LIBS = $(HTTP_PARSER_LIBS)
endif
if LOCAL_PROTOBUF_C
AM_CPPFLAGS += -I$(top_srcdir)/src/protobuf/
NEEDED_LIBPROTOBUF_LIBS = $(top_srcdir)/src/protobuf/libprotobuf.a
else
NEEDED_LIBPROTOBUF_LIBS = $(LIBPROTOBUF_C_LIBS)
endif

View File

@@ -1,23 +1,13 @@
AM_CPPFLAGS = -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
include ../common.mk
AM_CPPFLAGS += -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
-I$(srcdir)/ -I$(srcdir)/../ -I$(builddir)/../../ -I$(srcdir)/../../ \
-I$(builddir)/../ $(LIBPROTOBUF_C_CFLAGS) $(LIBTALLOC_CFLAGS)
if LOCAL_TALLOC
AM_CPPFLAGS += -I$(srcdir)/../ccan/talloc
endif
if LOCAL_HTTP_PARSER
AM_CPPFLAGS += -I$(srcdir)/../http-parser/
endif
-I$(builddir)/../ $(LIBPROTOBUF_C_CFLAGS) $(LIBTALLOC_CFLAGS)
# Files common to ocserv and occtl.
libcommon_a_SOURCES=common.c common.h system.c system.h \
cloexec.c cloexec.h
libcommon_a_LIBS = ../../gl/libgnu.a
libcommon_a_LIBS = ../../gl/libgnu.a $(NEEDED_LIBPROTOBUF_LIBS)
noinst_LIBRARIES = libcommon.a
if LOCAL_PROTOBUF_C
AM_CPPFLAGS += -I$(srcdir)/../protobuf/
libcommon_a_LIBS += ../protobuf/libprotobuf.a
endif

View File

@@ -1,16 +1,10 @@
AM_CPPFLAGS = -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
include ../common.mk
AM_CPPFLAGS += -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
-I$(srcdir)/ -I$(srcdir)/../ -I$(builddir)/../../ -I$(builddir)/../ \
$(LIBNL3_CFLAGS) $(LIBPROTOBUF_C_CFLAGS) $(LIBTALLOC_CFLAGS) \
-I$(srcdir)/../common/ -I$(builddir)/../common/
if LOCAL_TALLOC
AM_CPPFLAGS += -I$(srcdir)/../ccan/talloc
endif
if LOCAL_HTTP_PARSER
AM_CPPFLAGS += -I$(srcdir)/../http-parser/
endif
EXTRA_DIST = args.def
bin_PROGRAMS = occtl
@@ -18,13 +12,8 @@ bin_PROGRAMS = occtl
occtl_SOURCES = occtl.c pager.c occtl.h time.c cache.c ip-cache.c \
nl.c ctl.h print.c json.c json.h hex.c hex.h
occtl_LDADD = ../../gl/libgnu.a ../common/libcommon.a $(LIBREADLINE_LIBS) \
$(LIBNL3_LIBS) $(LIBPROTOBUF_C_LIBS) $(LIBTALLOC_LIBS) ../ccan/libccan.a \
../libipc.a
if LOCAL_PROTOBUF_C
AM_CPPFLAGS += -I$(srcdir)/../protobuf/
occtl_LDADD += ../protobuf/libprotobuf.a
endif
$(LIBNL3_LIBS) $(NEEDED_LIBPROTOBUF_LIBS) $(LIBTALLOC_LIBS) ../ccan/libccan.a \
../libipc.a $(NEEDED_LIBPROTOBUF_LIBS)
occtl_SOURCES += unix.c
@@ -37,4 +26,7 @@ occtl_SOURCES += unix.c
../common/libcommon.a:
cd ../common && $(MAKE) $(AM_MAKEFLAGS) libcommon.a
$(top_srcdir)/src/protobuf/libprotobuf.a:
cd ../protobuf && $(MAKE) $(AM_MAKEFLAGS) libprotobuf.a
.PHONY: ../libipc.a ../ccan/libccan.a ../common/libcommon.a

View File

@@ -1,8 +1,9 @@
AM_CPPFLAGS = -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
include ../common.mk
AM_CPPFLAGS += -I$(srcdir)/../../gl/ -I$(builddir)/../../gl/ \
-I$(srcdir)/ -I$(srcdir)/../ -I$(builddir)/../../ \
-I$(builddir) $(LIBTALLOC_CFLAGS) $(LIBOPTS_CFLAGS)
include ../common.mk
EXTRA_DIST = args.def
@@ -14,7 +15,7 @@ noinst_LIBRARIES = libcmd-ocpasswd.a
libcmd_ocpasswd_a_SOURCES = args.def args.c args.h
ocpasswd_SOURCES = ocpasswd.c
ocpasswd_LDADD = ../../gl/libgnu.a $(NEEDED_LIBOPTS2) libcmd-ocpasswd.a
ocpasswd_LDADD = ../../gl/libgnu.a $(NEEDED_LIBOPTS) libcmd-ocpasswd.a
ocpasswd_LDADD += $(LIBGNUTLS_LIBS) $(LIBCRYPT)
args.c: $(srcdir)/args.def $(builddir)/../version.inc

View File

@@ -1,3 +1,5 @@
include ../src/common.mk
EXTRA_DIST = ca-key.pem ca.pem common.sh server-cert.pem server-key.pem test1.config \
test1.passwd test-user-cert.config user-cert.pem user-key.pem test3.config test-iroute.config \
user-config/test user-config-opt/test test-pass-script.config test-multi-cookie.config \
@@ -31,7 +33,7 @@ dist_check_SCRIPTS += test-pass test-pass-cert test-cert test-group-pass \
test-enc-key test-sighup-key-change
endif
AM_CPPFLAGS = \
AM_CPPFLAGS += \
$(LIBOPTS_CFLAGS) \
$(LIBTALLOC_CFLAGS) \
-I$(top_srcdir)/src/ \
@@ -43,18 +45,6 @@ AM_CPPFLAGS = \
-I$(top_srcdir)/ \
-I$(top_builddir)/
if LOCAL_TALLOC
AM_CPPFLAGS += -I$(srcdir)/../src/ccan/talloc
endif
if LOCAL_HTTP_PARSER
AM_CPPFLAGS += -I$(srcdir)/../src/http-parser/
endif
if LOCAL_PROTOBUF_C
AM_CPPFLAGS += -I$(srcdir)/../src/protobuf/
endif
kkdcp_parsing_SOURCES = kkdcp-parsing.c
kkdcp_parsing_LDADD = ../gl/libgnu.a $(LIBTALLOC_LIBS) ../src/ccan/libccan.a