aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authoraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-01-15 14:04:57 +0000
committeraldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-01-15 14:04:57 +0000
commita532478c9fef863dea125eb66441f715cf5d5c38 (patch)
treec0aaacfeb97a9bc74e73f8ff36ecbf1fd173808b /libbb
parent0c482ced822cfada034ff19b3e1b81f0ef6a6cf8 (diff)
downloadbusybox-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.in95
-rw-r--r--libbb/find_mount_point.c5
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
7LIBBB_AR:=libbb.a
8ifndef $(LIBBB_DIR) 7ifndef $(LIBBB_DIR)
9LIBBB_DIR:=$(top_builddir)/libbb/ 8LIBBB_DIR:=$(top_builddir)/libbb
10endif 9endif
11srcdir=$(top_srcdir)/libbb 10srcdir=$(top_srcdir)/libbb
12 11
13LIBBB_SRC-y:= \ 12LIBBB-n:=
13LIBBB-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
39LIBBB_SRC-$(CONFIG_FEATURE_SHADOWPASSWDS)+= pwd2spwd.c 39# conditionally compiled objects:
40LIBBB-$(CONFIG_FEATURE_SHADOWPASSWDS)+=pwd2spwd.c
41LIBBB-$(CONFIG_FEATURE_MTAB_SUPPORT)+= mtab.c
40 42
41LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC-y))
42 43
44LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y))
45
46# 1:N objects
43LIBBB_MSRC0:=$(srcdir)/messages.c 47LIBBB_MSRC0:=$(srcdir)/messages.c
44LIBBB_MOBJ0:=full_version.o \ 48LIBBB_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
56LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0))
57$(LIBBB_MOBJ0):$(LIBBB_MSRC0)
58 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
52 59
53LIBBB_MSRC1:=$(srcdir)/xfuncs.c 60LIBBB_MSRC1:=$(srcdir)/xfuncs.c
54LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \ 61LIBBB_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
64LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1))
65$(LIBBB_MOBJ1):$(LIBBB_MSRC1)
66 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
57 67
58LIBBB_MSRC2:=$(srcdir)/printf.c 68LIBBB_MSRC2:=$(srcdir)/printf.c
59LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o 69LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o
70LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2))
71$(LIBBB_MOBJ2):$(LIBBB_MSRC2)
72 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
60 73
61LIBBB_MSRC3:=$(srcdir)/xgetularg.c 74LIBBB_MSRC3:=$(srcdir)/xgetularg.c
62LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \ 75LIBBB_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
77LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3))
78$(LIBBB_MOBJ3):$(LIBBB_MSRC3)
79 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
64 80
65LIBBB_MSRC4:=$(srcdir)/safe_strtol.c 81LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
66LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o 82LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
83LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4))
84$(LIBBB_MOBJ4):$(LIBBB_MSRC4)
85 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
67 86
68LIBBB_MSRC5:=$(srcdir)/bb_pwd.c 87LIBBB_MSRC5:=$(srcdir)/bb_pwd.c
69LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \ 88LIBBB_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
90LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5))
91$(LIBBB_MOBJ5):$(LIBBB_MSRC5)
92 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
71 93
72LIBBB_MSRC6:=$(srcdir)/llist.c 94LIBBB_MSRC6:=$(srcdir)/llist.c
73LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o 95LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o
96LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6))
97$(LIBBB_MOBJ6):$(LIBBB_MSRC6)
98 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
74 99
75LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
76LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
77LIBBB_MOBJS2=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ2))
78LIBBB_MOBJS3=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ3))
79LIBBB_MOBJS4=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ4))
80LIBBB_MOBJS5=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ5))
81LIBBB_MOBJS6=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ6))
82 100
83libraries-y+=$(LIBBB_DIR)$(LIBBB_AR) 101# We need the names of the object files built from MSRC for the L_ defines
102LIBBB_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) \ 104LIBBB_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 107LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC))
91 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
92 108
93$(LIBBB_MOBJS0): $(LIBBB_MSRC0) 109LIBBB_AR:=$(LIBBB_DIR)/libbb.a
94 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ 110libraries-y+=$(LIBBB_AR)
95 111
96$(LIBBB_MOBJS1): $(LIBBB_MSRC1) 112needcrypt-y:=
97 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ 113ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),)
114needcrypt-y:=y
115else
116ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),)
117needcrypt-y:=y
118endif
119endif
120
121ifeq ($(needcrypt-y),y)
122 LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
123endif
98 124
99$(LIBBB_MOBJS2): $(LIBBB_MSRC2) 125# all 1:1 objects
100 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ 126LIBBB_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) 131LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c)
106 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@ 132LIBRARY_SRC-y+=$(LIBBB-y)
133LIBRARY_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 $@ 136LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ))))
137LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y)
138LIBRARY_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. */