* Makefile.in, configure.in, configure,
[fw/sdcc] / device / lib / mcs51 / Makefile.in
index 294048428a0eeacd867e19b95567c34b7a5b5cc4..16a2deab337b3a4aac6743f739c105be731772bc 100644 (file)
@@ -4,9 +4,12 @@ srcdir = @srcdir@
 top_srcdir   = @top_srcdir@
 top_builddir = @top_builddir@
 
+LIB_TYPE     = @LIB_TYPE@
 SAS = $(top_builddir)/bin/asx8051
 SCC = $(top_builddir)/bin/sdcc
 
+PORTDIR = ../build/$(PORT)
+
 OBJ = crtstart.rel crtxinit.rel crtxclear.rel crtclear.rel crtxstack.rel \
       crtpagesfr.rel crtbank.rel crtcall.rel
 
@@ -18,11 +21,22 @@ ASFLAGS = -plosgff
 
 CFLAGS = -I$(top_srcdir)/include --std-c89
 
-all: $(LIB)
-
-$(LIB): $(OBJ) Makefile
-       rm -f $(LIB)
-       for i in $(OBJ); do echo $$i >> $(LIB); done
+all: $(PORTDIR)/$(LIB)
+
+$(PORTDIR)/$(LIB): $(OBJ) Makefile
+ifeq ($(LIB_TYPE), SDCCLIB)
+       rm -f $@; \
+       ../../../bin/sdcclib -a $@ $(OBJ)
+else ifeq ($(LIB_TYPE), AR)
+       ar -Scq $@ $(OBJ)
+else ifeq ($(LIB_TYPE), RANLIB)
+       ar -Scq $@ $(OBJ)
+       $(top_builddir)/bin/asranlib $@
+else
+       rm -f $@
+       for i in $(basename $(OBJ)); do echo $$i >>$@; done
+       cp $(OBJ) $(PORTDIR)
+endif
 
 %.rel: %.c
        $(CC) $(CFLAGS) -c $<