new solution for empty lib dir (old one had some problems)
[musl] / Makefile
index d0f16df..56bfb40 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ GENH = include/bits/alltypes.h
 
 CFLAGS  = -Os -nostdinc -ffreestanding -std=c99 -D_XOPEN_SOURCE=700 -pipe
 LDFLAGS = -nostdlib -shared -Wl,-Bsymbolic
 
 CFLAGS  = -Os -nostdinc -ffreestanding -std=c99 -D_XOPEN_SOURCE=700 -pipe
 LDFLAGS = -nostdlib -shared -Wl,-Bsymbolic
-INC     = -I./include -I./src/internal
+INC     = -I./include -I./src/internal -I./arch/$(ARCH)
 PIC     = -fPIC
 AR      = $(CROSS_COMPILE)ar
 RANLIB  = $(CROSS_COMPILE)ranlib
 PIC     = -fPIC
 AR      = $(CROSS_COMPILE)ar
 RANLIB  = $(CROSS_COMPILE)ranlib
@@ -54,6 +54,7 @@ clean:
        rm -f include/bits
 
 include/bits:
        rm -f include/bits
 
 include/bits:
+       @test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
        ln -sf ../arch/$(ARCH)/bits $@
 
 include/bits/alltypes.h.sh: include/bits
        ln -sf ../arch/$(ARCH)/bits $@
 
 include/bits/alltypes.h.sh: include/bits
@@ -83,6 +84,7 @@ lib/libc.a: $(OBJS)
        $(RANLIB) $@
 
 $(EMPTY_LIBS):
        $(RANLIB) $@
 
 $(EMPTY_LIBS):
+       rm -f $@
        $(AR) rc $@
 
 lib/%.o: crt/%.o
        $(AR) rc $@
 
 lib/%.o: crt/%.o