summaryrefslogtreecommitdiffstats
path: root/sdcard
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-08-23 21:12:12 -0700
committerTom Marshall <tdm@cyngn.com>2015-11-04 06:34:22 -0800
commit22fffcc3d469176f9a7d52d7c6fe68186e9592ab (patch)
tree1369ce577ec00ddee8fd1320da2e94476cb0f42e /sdcard
parent70009dccfb95e55284a2b53e48ec014c79fdd0e1 (diff)
downloadsystem_core-22fffcc3d469176f9a7d52d7c6fe68186e9592ab.tar.gz
system_core-22fffcc3d469176f9a7d52d7c6fe68186e9592ab.tar.bz2
system_core-22fffcc3d469176f9a7d52d7c6fe68186e9592ab.zip
sdcard: Allow building as a static library
* Split main() out in order to allow linking with a multi-call executable such as recovery. Change-Id: I3325135e47e4dd5af3912f5ce67ec64007d54a63
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/Android.mk12
-rw-r--r--sdcard/main.c21
-rw-r--r--sdcard/sdcard.c2
3 files changed, 31 insertions, 4 deletions
diff --git a/sdcard/Android.mk b/sdcard/Android.mk
index 89c361380..b50a818d7 100644
--- a/sdcard/Android.mk
+++ b/sdcard/Android.mk
@@ -7,9 +7,15 @@ LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr
endif
LOCAL_SRC_FILES := sdcard.c
-LOCAL_MODULE := sdcard
+LOCAL_MODULE := libsdcard
LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror
+LOCAL_MODULE_TAGS := optional
+include $(BUILD_STATIC_LIBRARY)
-LOCAL_SHARED_LIBRARIES := libcutils
-
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := main.c
+LOCAL_MODULE := sdcard
+LOCAL_CFLAGS := -Wall -Wno-unused-parameter -Werror
+LOCAL_STATIC_LIBRARIES := libsdcard
+LOCAL_SHARED_LIBRARIES := libc libcutils
include $(BUILD_EXECUTABLE)
diff --git a/sdcard/main.c b/sdcard/main.c
new file mode 100644
index 000000000..ad2405bdd
--- /dev/null
+++ b/sdcard/main.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+extern int sdcard_main(int argc, char **argv);
+
+int main(int argc, char **argv) {
+ return sdcard_main(argc, argv);
+}
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c
index 840642b62..13009aa51 100644
--- a/sdcard/sdcard.c
+++ b/sdcard/sdcard.c
@@ -1904,7 +1904,7 @@ static void run(const char* source_path, const char* label, uid_t uid,
exit(1);
}
-int main(int argc, char **argv) {
+int sdcard_main(int argc, char **argv) {
const char *source_path = NULL;
const char *label = NULL;
uid_t uid = 0;