diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-01-15 14:04:57 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-01-15 14:04:57 +0000 |
commit | a532478c9fef863dea125eb66441f715cf5d5c38 (patch) | |
tree | c0aaacfeb97a9bc74e73f8ff36ecbf1fd173808b /libbb | |
parent | 0c482ced822cfada034ff19b3e1b81f0ef6a6cf8 (diff) | |
download | busybox-w32-a532478c9fef863dea125eb66441f715cf5d5c38.tar.gz busybox-w32-a532478c9fef863dea125eb66441f715cf5d5c38.tar.bz2 busybox-w32-a532478c9fef863dea125eb66441f715cf5d5c38.zip |
- shared libbusybox.
- IMA compilation option (aka IPO, IPA,..)
Please holler if i broke something..
git-svn-id: svn://busybox.net/trunk/busybox@13346 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Makefile.in | 95 | ||||
-rw-r--r-- | libbb/find_mount_point.c | 5 |
2 files changed, 65 insertions, 35 deletions
diff --git a/libbb/Makefile.in b/libbb/Makefile.in index 91698a919..bb3790a58 100644 --- a/libbb/Makefile.in +++ b/libbb/Makefile.in | |||
@@ -4,13 +4,13 @@ | |||
4 | # | 4 | # |
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. |
6 | 6 | ||
7 | LIBBB_AR:=libbb.a | ||
8 | ifndef $(LIBBB_DIR) | 7 | ifndef $(LIBBB_DIR) |
9 | LIBBB_DIR:=$(top_builddir)/libbb/ | 8 | LIBBB_DIR:=$(top_builddir)/libbb |
10 | endif | 9 | endif |
11 | srcdir=$(top_srcdir)/libbb | 10 | srcdir=$(top_srcdir)/libbb |
12 | 11 | ||
13 | LIBBB_SRC-y:= \ | 12 | LIBBB-n:= |
13 | LIBBB-y:= \ | ||
14 | bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ | 14 | bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \ |
15 | compare_string_array.c concat_path_file.c copy_file.c copyfd.c \ | 15 | compare_string_array.c concat_path_file.c copy_file.c copyfd.c \ |
16 | correct_password.c create_icmp_socket.c create_icmp6_socket.c \ | 16 | correct_password.c create_icmp_socket.c create_icmp6_socket.c \ |
@@ -36,10 +36,14 @@ LIBBB_SRC-y:= \ | |||
36 | warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c \ | 36 | warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c \ |
37 | bb_echo.c bb_do_delay.c | 37 | bb_echo.c bb_do_delay.c |
38 | 38 | ||
39 | LIBBB_SRC-$(CONFIG_FEATURE_SHADOWPASSWDS)+= pwd2spwd.c | 39 | # conditionally compiled objects: |
40 | LIBBB-$(CONFIG_FEATURE_SHADOWPASSWDS)+=pwd2spwd.c | ||
41 | LIBBB-$(CONFIG_FEATURE_MTAB_SUPPORT)+= mtab.c | ||
40 | 42 | ||
41 | LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC-y)) | ||
42 | 43 | ||
44 | LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y)) | ||
45 | |||
46 | # 1:N objects | ||
43 | LIBBB_MSRC0:=$(srcdir)/messages.c | 47 | LIBBB_MSRC0:=$(srcdir)/messages.c |
44 | LIBBB_MOBJ0:=full_version.o \ | 48 | LIBBB_MOBJ0:=full_version.o \ |
45 | memory_exhausted.o invalid_date.o io_error.o \ | 49 | memory_exhausted.o invalid_date.o io_error.o \ |
@@ -49,65 +53,90 @@ LIBBB_MOBJ0:=full_version.o \ | |||
49 | securetty_file.o motd_file.o \ | 53 | securetty_file.o motd_file.o \ |
50 | msg_standard_input.o msg_standard_output.o shell_file.o \ | 54 | msg_standard_input.o msg_standard_output.o shell_file.o \ |
51 | bb_dev_null.o bb_common_bufsiz1.o | 55 | bb_dev_null.o bb_common_bufsiz1.o |
56 | LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0)) | ||
57 | $(LIBBB_MOBJ0):$(LIBBB_MSRC0) | ||
58 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
52 | 59 | ||
53 | LIBBB_MSRC1:=$(srcdir)/xfuncs.c | 60 | LIBBB_MSRC1:=$(srcdir)/xfuncs.c |
54 | LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ | 61 | LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ |
55 | xfopen.o xopen.o xread.o xread_all.o xread_char.o \ | 62 | xfopen.o xopen.o xread.o xread_all.o xread_char.o \ |
56 | xferror.o xferror_stdout.o xfflush_stdout.o strlen.o | 63 | xferror.o xferror_stdout.o xfflush_stdout.o strlen.o |
64 | LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1)) | ||
65 | $(LIBBB_MOBJ1):$(LIBBB_MSRC1) | ||
66 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
57 | 67 | ||
58 | LIBBB_MSRC2:=$(srcdir)/printf.c | 68 | LIBBB_MSRC2:=$(srcdir)/printf.c |
59 | LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o | 69 | LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o |
70 | LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2)) | ||
71 | $(LIBBB_MOBJ2):$(LIBBB_MSRC2) | ||
72 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
60 | 73 | ||
61 | LIBBB_MSRC3:=$(srcdir)/xgetularg.c | 74 | LIBBB_MSRC3:=$(srcdir)/xgetularg.c |
62 | LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ | 75 | LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ |
63 | xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o | 76 | xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o |
77 | LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3)) | ||
78 | $(LIBBB_MOBJ3):$(LIBBB_MSRC3) | ||
79 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
64 | 80 | ||
65 | LIBBB_MSRC4:=$(srcdir)/safe_strtol.c | 81 | LIBBB_MSRC4:=$(srcdir)/safe_strtol.c |
66 | LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o | 82 | LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o |
83 | LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4)) | ||
84 | $(LIBBB_MOBJ4):$(LIBBB_MSRC4) | ||
85 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
67 | 86 | ||
68 | LIBBB_MSRC5:=$(srcdir)/bb_pwd.c | 87 | LIBBB_MSRC5:=$(srcdir)/bb_pwd.c |
69 | LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ | 88 | LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ |
70 | bb_getug.o get_ug_id.o | 89 | bb_getug.o get_ug_id.o |
90 | LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5)) | ||
91 | $(LIBBB_MOBJ5):$(LIBBB_MSRC5) | ||
92 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
71 | 93 | ||
72 | LIBBB_MSRC6:=$(srcdir)/llist.c | 94 | LIBBB_MSRC6:=$(srcdir)/llist.c |
73 | LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o | 95 | LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o |
96 | LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6)) | ||
97 | $(LIBBB_MOBJ6):$(LIBBB_MSRC6) | ||
98 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $< | ||
74 | 99 | ||
75 | LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0)) | ||
76 | LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1)) | ||
77 | LIBBB_MOBJS2=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ2)) | ||
78 | LIBBB_MOBJS3=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ3)) | ||
79 | LIBBB_MOBJS4=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ4)) | ||
80 | LIBBB_MOBJS5=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ5)) | ||
81 | LIBBB_MOBJS6=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ6)) | ||
82 | 100 | ||
83 | libraries-y+=$(LIBBB_DIR)$(LIBBB_AR) | 101 | # We need the names of the object files built from MSRC for the L_ defines |
102 | LIBBB_ALL_MOBJ:=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6) | ||
84 | 103 | ||
85 | $(LIBBB_DIR)$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \ | 104 | LIBBB_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \ |
86 | $(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4) $(LIBBB_MOBJS5) \ | 105 | $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6) |
87 | $(LIBBB_MOBJS6) | ||
88 | $(AR) $(ARFLAGS) $(@) $(LIBBB_OBJS) $(^) | ||
89 | 106 | ||
90 | $(LIBBB_DIR)%.o: $(srcdir)/%.c | 107 | LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC)) |
91 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< | ||
92 | 108 | ||
93 | $(LIBBB_MOBJS0): $(LIBBB_MSRC0) | 109 | LIBBB_AR:=$(LIBBB_DIR)/libbb.a |
94 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 110 | libraries-y+=$(LIBBB_AR) |
95 | 111 | ||
96 | $(LIBBB_MOBJS1): $(LIBBB_MSRC1) | 112 | needcrypt-y:= |
97 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 113 | ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),) |
114 | needcrypt-y:=y | ||
115 | else | ||
116 | ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),) | ||
117 | needcrypt-y:=y | ||
118 | endif | ||
119 | endif | ||
120 | |||
121 | ifeq ($(needcrypt-y),y) | ||
122 | LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES)) | ||
123 | endif | ||
98 | 124 | ||
99 | $(LIBBB_MOBJS2): $(LIBBB_MSRC2) | 125 | # all 1:1 objects |
100 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 126 | LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y)) |
127 | $(LIBBB_DIR)/%.o: $(srcdir)/%.c | ||
128 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $< | ||
101 | 129 | ||
102 | $(LIBBB_MOBJS3): $(LIBBB_MSRC3) | ||
103 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | ||
104 | 130 | ||
105 | $(LIBBB_MOBJS4): $(LIBBB_MSRC4) | 131 | LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c) |
106 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 132 | LIBRARY_SRC-y+=$(LIBBB-y) |
133 | LIBRARY_SRC-a+=$(LIBBB_SRC-a) | ||
107 | 134 | ||
108 | $(LIBBB_MOBJS5): $(LIBBB_MSRC5) | 135 | # all defines needed for 1:N objects |
109 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 136 | LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ)))) |
137 | LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y) | ||
138 | LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y) | ||
110 | 139 | ||
111 | $(LIBBB_MOBJS6): $(LIBBB_MSRC6) | 140 | $(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ) |
112 | $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ | 141 | $(AR) $(ARFLAGS) $(@) $(^) |
113 | 142 | ||
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c index eec738aea..4d27b4809 100644 --- a/libbb/find_mount_point.c +++ b/libbb/find_mount_point.c | |||
@@ -48,11 +48,12 @@ extern struct mntent *find_mount_point(const char *name, const char *table) | |||
48 | mountDevice = s.st_dev; | 48 | mountDevice = s.st_dev; |
49 | 49 | ||
50 | 50 | ||
51 | if ((mountTable = setmntent(table ? : bb_path_mtab_file, "r")) == 0) | 51 | if ((mountTable = setmntent(table ? table : bb_path_mtab_file, "r")) == 0) |
52 | return 0; | 52 | return 0; |
53 | 53 | ||
54 | while ((mountEntry = getmntent(mountTable)) != 0) { | 54 | while ((mountEntry = getmntent(mountTable)) != 0) { |
55 | if (strcmp(name, mountEntry->mnt_dir) == 0 | 55 | |
56 | if(strcmp(name, mountEntry->mnt_dir) == 0 | ||
56 | || strcmp(name, mountEntry->mnt_fsname) == 0) /* String match. */ | 57 | || strcmp(name, mountEntry->mnt_fsname) == 0) /* String match. */ |
57 | break; | 58 | break; |
58 | if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == mountDevice) /* Match the device. */ | 59 | if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == mountDevice) /* Match the device. */ |