1 LOCAL_PATH:= $(call my-dir) 2 3 common_src_files := \ 4 src/assertion.c \ 5 src/avrule_block.c \ 6 src/avtab.c \ 7 src/boolean_record.c \ 8 src/booleans.c \ 9 src/conditional.c \ 10 src/constraint.c \ 11 src/context.c \ 12 src/context_record.c \ 13 src/debug.c \ 14 src/ebitmap.c \ 15 src/expand.c \ 16 src/genbools.c \ 17 src/genusers.c \ 18 src/handle.c \ 19 src/hashtab.c \ 20 src/hierarchy.c \ 21 src/iface_record.c \ 22 src/interfaces.c \ 23 src/link.c \ 24 src/mls.c \ 25 src/module.c \ 26 src/module_to_cil.c \ 27 src/node_record.c \ 28 src/nodes.c \ 29 src/polcaps.c \ 30 src/policydb.c \ 31 src/policydb_convert.c \ 32 src/policydb_public.c \ 33 src/port_record.c \ 34 src/ports.c \ 35 src/roles.c \ 36 src/services.c \ 37 src/sidtab.c \ 38 src/symtab.c \ 39 src/user_record.c \ 40 src/users.c \ 41 src/util.c \ 42 src/write.c 43 44 cil_src_files := \ 45 cil/src/cil_binary.c \ 46 cil/src/cil_build_ast.c \ 47 cil/src/cil.c \ 48 cil/src/cil_copy_ast.c \ 49 cil/src/cil_fqn.c \ 50 cil/src/cil_lexer.l \ 51 cil/src/cil_list.c \ 52 cil/src/cil_log.c \ 53 cil/src/cil_mem.c \ 54 cil/src/cil_parser.c \ 55 cil/src/cil_policy.c \ 56 cil/src/cil_post.c \ 57 cil/src/cil_reset_ast.c \ 58 cil/src/cil_resolve_ast.c \ 59 cil/src/cil_stack.c \ 60 cil/src/cil_strpool.c \ 61 cil/src/cil_symtab.c \ 62 cil/src/cil_tree.c \ 63 cil/src/cil_verify.c 64 65 common_cflags := \ 66 -Wall -W -Wundef \ 67 -Wshadow -Wmissing-noreturn \ 68 -Wmissing-format-attribute 69 70 ifeq ($(HOST_OS), darwin) 71 common_cflags += -DDARWIN 72 endif 73 74 common_includes := \ 75 $(LOCAL_PATH)/include/ \ 76 $(LOCAL_PATH)/src/ \ 77 $(LOCAL_PATH)/cil/include/ \ 78 $(LOCAL_PATH)/cil/src/ \ 79 80 ## 81 # "-x c" forces the lex/yacc files to be compiled as c the build system 82 # otherwise forces them to be c++. Need to also add an explicit -std because the 83 # build system will soon default C++ to -std=c++11. 84 yacc_flags := -x c -std=gnu89 85 86 ## 87 # libsepol.so 88 # 89 include $(CLEAR_VARS) 90 91 LOCAL_MODULE := libsepol 92 LOCAL_MODULE_TAGS := optional 93 LOCAL_COPY_HEADERS_TO := sepol 94 LOCAL_COPY_HEADERS := include/sepol/handle.h include/sepol/policydb.h cil/include/cil/cil.h 95 LOCAL_C_INCLUDES := $(common_includes) 96 LOCAL_CFLAGS := $(yacc_flags) $(common_cflags) 97 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files) 98 LOCAL_MODULE_CLASS := SHARED_LIBRARIES 99 100 include $(BUILD_HOST_SHARED_LIBRARY) 101 102 ## 103 # libsepol.a 104 # 105 include $(CLEAR_VARS) 106 107 LOCAL_MODULE := libsepol 108 LOCAL_MODULE_TAGS := optional 109 LOCAL_C_INCLUDES := $(common_includes) 110 LOCAL_CFLAGS := $(yacc_flags) $(common_cflags) 111 LOCAL_SRC_FILES := $(common_src_files) $(cil_src_files) 112 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 113 114 include $(BUILD_HOST_STATIC_LIBRARY) 115 116 ## 117 # chkcon 118 # 119 include $(CLEAR_VARS) 120 121 LOCAL_MODULE := chkcon 122 LOCAL_MODULE_TAGS := optional 123 LOCAL_C_INCLUDES := $(common_includes) 124 LOCAL_CFLAGS := $(common_cflags) 125 LOCAL_SRC_FILES := utils/chkcon.c 126 LOCAL_SHARED_LIBRARIES := libsepol 127 LOCAL_MODULE_CLASS := EXECUTABLES 128 129 include $(BUILD_HOST_EXECUTABLE) 130 131 include $(CLEAR_VARS) 132 133 LOCAL_MODULE := libsepol 134 LOCAL_MODULE_TAGES := optional 135 LOCAL_C_INCLUDES := $(common_includes) 136 LOCAL_CFLAGS := $(common_cflags) 137 LOCAL_SRC_FILES := $(common_src_files) 138 LOCAL_MODULE_CLASS := STATIC_LIBRARIES 139 140 include $(BUILD_STATIC_LIBRARY) 141