OBJS = $(SRCS:.c=.o)
LOBJS = $(OBJS:.o=.lo)
GENH = include/bits/alltypes.h
+IMPH = src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h
LDFLAGS =
CPPFLAGS =
CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc
CFLAGS_ALL = $(CFLAGS_C99FSE)
-CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./src/internal -I./include -I./arch/$(ARCH)
+CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./arch/$(ARCH) -I./src/internal -I./include
CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS)
CFLAGS_ALL_STATIC = $(CFLAGS_ALL)
CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED -O3
%.o: $(ARCH)/%.s
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
-%.o: %.c $(GENH)
+%.o: %.c $(GENH) $(IMPH)
$(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
%.lo: $(ARCH)/%.s
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
-%.lo: %.c $(GENH)
+%.lo: %.c $(GENH) $(IMPH)
$(CC) $(CFLAGS_ALL_SHARED) -c -o $@ $<
lib/libc.so: $(LOBJS)
$(DESTDIR)$(includedir)/%: include/%
install -D -m 644 $< $@
-$(DESTDIR)$(LDSO_PATHNAME): lib/libc.so
- install -d -m 755 $(DESTDIR)$(syslibdir) || true
+$(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(syslibdir)
ln -sf $(libdir)/libc.so $@ || true
+$(DESTDIR)$(syslibdir):
+ install -d -m 755 $(DESTDIR)$(syslibdir)
+
.PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
.PHONY: all clean install