summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile74
1 files changed, 45 insertions, 29 deletions
diff --git a/Makefile b/Makefile
index 1c568e425..ed40ceae9 100644
--- a/Makefile
+++ b/Makefile
@@ -31,32 +31,32 @@ include Rules.mak
DIRS = extra misc pwd_grp stdio string termios net signal stdlib sysdeps unistd
-ifeq ($(HAS_MMU),true)
+ifeq ($(strip $(HAS_MMU)),true)
DO_SHARED=shared
endif
-all: libc.a $(DO_SHARED) done
+all: $(STATIC_NAME) $(DO_SHARED) done
-libc.a: halfclean headers subdirs
- $(CROSS)ranlib libc.a
+$(STATIC_NAME): halfclean headers subdirs
+ $(CROSS)ranlib $(STATIC_NAME)
# Surely there is a better way to do this then dumping all
# the objects into a tmp dir. Please -- someone enlighten me.
-shared: libc.a
+shared: $(STATIC_NAME)
@rm -rf tmp
@mkdir tmp
- @(cd tmp; ar -x ../libc.a)
+ @(cd tmp; ar -x ../$(STATIC_NAME))
@(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
+ $(CC) -s -nostdlib -shared -o $(SHARED_NAME) -Wl,-soname,$(SHARED_NAME) tmp/*.o
@rm -rf tmp
-done: libc.a $(DO_SHARED)
+done: $(STATIC_NAME) $(DO_SHARED)
@echo
@echo Finally finished compiling...
@echo
halfclean:
- @rm -f libc.a libuClibc.so.1 crt0.o
+ @rm -f $(STATIC_NAME) $(SHARED_NAME) crt0.o
headers: dummy
@rm -f include/asm include/linux include/bits
@@ -83,7 +83,7 @@ tags:
clean: subdirs_clean
@rm -rf tmp
- rm -f libc.a crt0.o libuClibc.so.1
+ rm -f $(STATIC_NAME) crt0.o $(SHARED_NAME)
rm -f include/asm include/linux include/bits
subdirs: $(patsubst %, _dir_%, $(DIRS))
@@ -100,26 +100,42 @@ install:
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; \
+ @if [ -n "$(DO_SHARED)" ] ; then \
+ set -x; \
+ mv -f $(INSTALL_DIR)/lib/$(SHARED_NAME) \
+ $(INSTALL_DIR)/lib/$(SHARED_NAME).old > /dev/null 2>&1; \
+ rm -f $(INSTALL_DIR)/lib/$(SHARED_NAME).old; \
+ cp $(SHARED_NAME) $(INSTALL_DIR)/lib; \
+ chmod 644 $(INSTALL_DIR)/lib/$(SHARED_NAME); \
+ chown -R root.root $(INSTALL_DIR)/lib/$(SHARED_NAME); \
+ rm -f $(INSTALL_DIR)/lib/libuClibc.so; \
+ ln -s $(INSTALL_DIR)/lib/$(SHARED_NAME) \
+ $(INSTALL_DIR)/lib/libuClibc.so; \
+ ldconfig; \
+ fi;
+ @if [ "$(HAS_MMU)" = "false" ] ; then \
+ set -x; \
+ 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/$(STATIC_NAME); \
+ cp $(STATIC_NAME) $(INSTALL_DIR)/lib; \
+ chmod 644 $(INSTALL_DIR)/lib/$(STATIC_NAME); \
+ chown -R root.root $(INSTALL_DIR)/lib/$(STATIC_NAME); \
+ 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; \
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