# Makefile for uClibc
#
# Copyright (C) 2000 by Lineo, inc.
+# Copyright (C) 2000,2001 Erik Andersen <andersen@uclibc.org>
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Library General Public License as published by the Free
# other sundry sources. Files within this library are copyright by their
# respective copyright holders.
-TOPDIR=../../../
+TOPDIR=../../../../
include $(TOPDIR)Rules.mak
-LIBC=$(TOPDIR)libc.a
ASFLAGS=$(CFLAGS)
-SSRC=_start.S longjmp.S setjmp.S
+TARGET_MACHINE_TYPE=$(shell $(CC) -dumpmachine)
+
+CRT0=crt0.S
+CRT0_OBJ=crt0.o
+
+SSRC=longjmp.S setjmp.S vfork.S
SOBJS=$(patsubst %.S,%.o, $(SSRC))
-CSRC=fork.c vfork.c
+CSRC=inout_bwl.c
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(SOBJS) $(MOBJ) $(COBJS)
all: $(OBJS) $(LIBC)
-$(LIBC): ar-target
+$(LIBC): ar-target
-ar-target: $(OBJS)
+ar-target: $(OBJS) $(CRT0_OBJ)
$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
+ cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
-$(SOBJS):
- $(CC) $(CFLAGS) $< -c $*.S -o $*.o
+$(CRT0_OBJ): $(CRT0)
+ $(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-$(COBJS):
- $(CC) $(CFLAGS) $< -c $*.c -o $*.o
+$(SOBJS): %.o : %.S
+ $(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
+$(COBJS): %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+headers:
+ @(TOPDIR=$(TOPDIR) CC=$(CC) /bin/sh $(TOPDIR)/extra/scripts/gen_bits_syscall_h.sh > bits/syscall.h )
+
clean:
rm -f *.[oa] *~ core