1#
2# Copyright (C) 2015 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17LOCAL_PATH := $(call my-dir)
18
19# Definitions applying to all targets. Be sure to $(eval) this last.
20define firewalld_common
21  LOCAL_CPP_EXTENSION := .cc
22  LOCAL_CLANG := true
23  LOCAL_SHARED_LIBRARIES += \
24      libbrillo \
25      libbrillo-dbus \
26      libbrillo-minijail \
27      libchrome \
28      libchrome-dbus \
29      libdbus \
30      libminijail
31  LOCAL_CFLAGS += -Wall -Werror -Wno-unused-parameter
32  LOCAL_CPPFLAGS += -Wno-sign-promo
33endef
34
35# === libfirewalld-client (shared library) ===
36include $(CLEAR_VARS)
37LOCAL_MODULE := libfirewalld-client
38LOCAL_SRC_FILES := \
39    dbus_bindings/dbus-service-config.json \
40    dbus_bindings/org.chromium.Firewalld.dbus-xml
41LOCAL_DBUS_PROXY_PREFIX := firewalld
42include $(BUILD_SHARED_LIBRARY)
43
44# === libfirewalld (static library) ===
45include $(CLEAR_VARS)
46LOCAL_MODULE := libfirewalld
47LOCAL_SRC_FILES := \
48    dbus_bindings/dbus-service-config.json \
49    dbus_bindings/org.chromium.Firewalld.dbus-xml \
50    firewall_daemon.cc \
51    firewall_service.cc \
52    iptables.cc
53$(eval $(firewalld_common))
54include $(BUILD_STATIC_TEST_LIBRARY)
55
56# === firewalld ===
57include $(CLEAR_VARS)
58LOCAL_MODULE := firewalld
59LOCAL_INIT_RC := firewalld.rc
60LOCAL_SRC_FILES := \
61    main.cc
62LOCAL_STATIC_LIBRARIES := libfirewalld
63LOCAL_C_INCLUDES += external/gtest/include
64$(eval $(firewalld_common))
65include $(BUILD_EXECUTABLE)
66
67# === unittest ===
68include $(CLEAR_VARS)
69LOCAL_MODULE := firewalld_unittest
70ifdef BRILLO
71  LOCAL_MODULE_TAGS := debug
72endif
73LOCAL_SRC_FILES := \
74    iptables_unittest.cc \
75    mock_iptables.cc \
76    run_all_tests.cc
77LOCAL_STATIC_LIBRARIES := libfirewalld libgmock
78$(eval $(firewalld_common))
79include $(BUILD_NATIVE_TEST)
80