123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- include Rules.mak
- DIRS = extra misc pwd_grp stdio string termios net signal stdlib sysdeps unistd
- ifeq ($(HAS_MMU),true)
- DO_SHARED=shared
- endif
- all: libc.a $(DO_SHARED) done
- libc.a: halfclean headers subdirs
- $(CROSS)ranlib libc.a
- shared: libc.a
- @rm -rf tmp
- @mkdir tmp
- @(cd tmp; ar -x ../libc.a)
- @(cd tmp; CC=$(CC) /bin/sh ../extra/scripts/get-needed-libgcc-objects.sh)
- $(CC) -s -nostdlib -shared -o libuClibc.so.1 -Wl,-soname,libuClibc.so.1 tmp/*.o
- @rm -rf tmp
- done: libc.a $(DO_SHARED)
- @echo
- @echo Finally finished compiling...
- @echo
- halfclean:
- @rm -f libc.a libuClibc.so.1 crt0.o
- headers: dummy
- @rm -f include/asm include/linux include/bits
- @ln -s $(KERNEL_SOURCE)/include/asm include/asm
- @if [ ! -f include/asm/unistd.h ] ; then \
- echo " "; \
- echo "The path '$(KERNEL_SOURCE)/include/asm' doesn't exist."; \
- echo "I bet you didn't set KERNEL_SOURCE, TARGET_ARCH or HAS_MMU in \`Config'"; \
- echo "correctly. Please edit \`Config' and fix these settings."; \
- echo " "; \
- /bin/false; \
- fi;
- @if [ $(HAS_MMU) != "true" ] && [ $(TARGET_ARCH) = "i386" ] ; then \
- echo "WARNING: I bet your x86 system really has an MMU, right?"; \
- echo " malloc and friends won't work unless you fix \`Config'"; \
- echo " "; \
- sleep 10; \
- fi;
- @ln -s $(KERNEL_SOURCE)/include/linux include/linux
- @ln -s ../sysdeps/linux/$(TARGET_ARCH)/bits include/bits
- tags:
- ctags -R
- clean: subdirs_clean
- @rm -rf tmp
- rm -f libc.a crt0.o libuClibc.so.1
- rm -f include/asm include/linux include/bits
- subdirs: $(patsubst %, _dir_%, $(DIRS))
- subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS) test)
- $(patsubst %, _dir_%, $(DIRS)) : dummy
- $(MAKE) -C $(patsubst _dir_%, %, $@)
- $(patsubst %, _dirclean_%, $(DIRS) test) : dummy
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
- install:
- @if [ `id -u` -ne 0 ]; then \
- echo "Aborting install -- You must be root."; \
- /bin/false; \
- fi;
- rm -f $(INSTALL_DIR)/include/asm
- rm -f $(INSTALL_DIR)/include/linux
- mkdir -p $(INSTALL_DIR)/include/bits
- ln -s $(KERNEL_SOURCE)/include/asm $(INSTALL_DIR)/include/asm
- ln -s $(KERNEL_SOURCE)/include/linux $(INSTALL_DIR)/include/linux
- find include/ -type f -depth -print | cpio -pdmu $(INSTALL_DIR)
- find include/bits/ -depth -print | cpio -pdmu $(INSTALL_DIR)
- rm -f $(INSTALL_DIR)/lib/libc.a
- cp libc.a $(INSTALL_DIR)/lib
- chmod 644 $(INSTALL_DIR)/lib/libc.a
- chown -R root.root $(INSTALL_DIR)/lib/libc.a
- if [ -f crt0.o ] ; then \
- rm -f $(INSTALL_DIR)/lib/crt0.o; \
- cp crt0.o $(INSTALL_DIR)/lib ; \
- chmod 644 $(INSTALL_DIR)/lib/crt0.o; \
- chown -R root.root $(INSTALL_DIR)/lib/crt0.o; \
- fi;
- chmod -R 775 `find $(INSTALL_DIR)/include -type d`
- chmod -R 644 `find $(INSTALL_DIR)/include -type f`
- chown -R root.root $(INSTALL_DIR)/include
- .PHONY: dummy
|