summaryrefslogtreecommitdiff
path: root/libc/unistd/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'libc/unistd/Makefile')
-rw-r--r--libc/unistd/Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/libc/unistd/Makefile b/libc/unistd/Makefile
index faebda604..c1ff28575 100644
--- a/libc/unistd/Makefile
+++ b/libc/unistd/Makefile
@@ -28,8 +28,13 @@ LIBC=$(TOPDIR)libc.a
CSRC=execl.c execlp.c execv.c execvep.c execvp.c getcwd.c getopt.c \
sleep.c sysconf.c getpass.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+MSRC=gnu_getopt.c
+MOBJ=_gnu_getopt_internal.o gnu_getopt_long.o gnu_getopt_long_only.o
+
+# WARNING! MOBJ _must_ come after COBJS for link to pick getopt
+# over gnu_getopt when appropriate.
+OBJS=$(COBJS) $(MOBJ)
all: $(OBJS) $(LIBC)
@@ -38,8 +43,12 @@ $(LIBC): ar-target subdirs
ar-target: $(OBJS)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
-$(COBJS):
- $(CC) $(CFLAGS) $< -c $*.c -o $*.o
+$(COBJS): %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(MOBJ): $(MSRC)
+ $(CC) $(CFLAGS) -DL_$* $< -c -o $*.o
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(OBJ): Makefile