diff options
-rw-r--r-- | Makefile | 74 | ||||
-rw-r--r-- | Rules.mak | 8 |
2 files changed, 49 insertions, 33 deletions
@@ -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 @@ -39,7 +39,7 @@ CCFLAGS=$(WARNINGS) $(OPTIMIZATION) -fno-builtin -nostdinc $(CPUFLAGS) -Dlinux - CFLAGS=$(ARCH_CFLAGS) $(CCFLAGS) $(DEFS) $(ARCH_CFLAGS2) -ifeq ($(DODEBUG),true) +ifeq ($(strip $(DODEBUG)),true) CFLAGS += -g LDFLAGS = -nostdlib -Wl,-warn-common STRIPTOOL = /bin/true -Since_we_are_debugging @@ -52,15 +52,15 @@ ifndef $(PREFIX) PREFIX = `pwd`/_install endif -ifneq ($(HAS_MMU),true) +ifneq ($(strip $(HAS_MMU)),true) CFLAGS += -D__HAS_NO_MMU__ endif -ifneq ($(HAS_FLOATS),true) +ifneq ($(strip $(HAS_FLOATS)),true) CFLAGS += -D__HAS_NO_FLOATS__ endif -ifeq ($(TARGET_ARCH),m68k) +ifeq ($(strip $(TARGET_ARCH)),m68k) CFLAGS += -D__VFORK_MACRO__ -Dconst= -D__const= -D__extension__= endif |