From e1be1eadeea92f61f457bf53e55ea6cc0443e9aa Mon Sep 17 00:00:00 2001 From: Jon Nelson Date: Sun, 6 Jan 2002 18:54:35 +0000 Subject: [PATCH] some more cleanups. This one works pretty well --- Makefile | 37 +++++++++++++++++++++++-------------- boa.mk | 7 ++----- busybox.mk | 12 ++++++------ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 30eeff580c..29e74a0fd6 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ TARGETS= -include busybox.mk -include boa.mk -world: $(TARGETS) root_fs +world: $(TARGETS) root_fs $(LINUX) root_fs: $(GENEXT2FS_DIR)/genext2fs $(TARGET_DIR) $(GENEXT2FS_DIR)/genext2fs \ @@ -85,11 +85,6 @@ root_fs: $(GENEXT2FS_DIR)/genext2fs $(TARGET_DIR) -d $(TARGET_DIR) \ -D $(SOURCE_DIR)/device_table.txt root_fs -$(STAGING_DIR)/.i_exist: - rm -rf $(STAGING_DIR) - mkdir $(STAGING_DIR) - touch $(STAGING_DIR)/.i_exist - $(STAGING_DIR)/.target_dir_exists: rm -rf $(TARGET_DIR) tar -xf $(SOURCE_DIR)/skel.tar @@ -104,6 +99,7 @@ $(SOURCE_DIR)/$(LINUX_SOURCE): done $(LINUX_DIR)/.unpacked: $(SOURCE_DIR)/$(LINUX_SOURCE) + rm -rf $(LINUX_DIR) # Keeps old versions from messing things up bunzip2 -c $(SOURCE_DIR)/$(LINUX_SOURCE) | tar -xv touch $(LINUX_DIR)/.unpacked @@ -113,14 +109,21 @@ $(SOURCE_DIR)/$(USERMODELINUX_PATCH): done $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked $(SOURCE_DIR)/$(USERMODELINUX_PATCH) + # This step cannot gracefully recover from interruption + @if [ -f $(LINUX_DIR)/.started_patch ]; then \ + echo "Something went wrong patching the kernel."; \ + echo "Please rm -rf the kernel directory (\"$(LINUX_DIR)\") and type \"make\" again."; \ + exit 1; \ + fi + touch $(LINUX_DIR)/.started_patch bzcat $(SOURCE_DIR)/$(USERMODELINUX_PATCH) | patch -d $(LINUX_DIR) -p1 cp -f $(KCONFIG) $(LINUX_DIR)/.config - touch $(LINUX_DIR)/.patched + mv $(LINUX_DIR)/.started_patch $(LINUX_DIR)/.patched # Hah! Atomic $(LINUX_DIR)/.um: $(LINUX_DIR)/.patched sed -e 's/^ARCH :=.*/ARCH=um/g' < $(LINUX_DIR)/Makefile > \ - $(LINUX_DIR)/Makefile.new && mv -f \ - $(LINUX_DIR)/Makefile.new $(LINUX_DIR)/Makefile + $(LINUX_DIR)/Makefile.new + mv -f $(LINUX_DIR)/Makefile.new $(LINUX_DIR)/Makefile touch $(LINUX_DIR)/.um $(LINUX_DIR)/.configdone: $(LINUX_DIR)/.um @@ -144,14 +147,20 @@ $(SOURCE_DIR)/$(UCLIBC_SOURCE): done; $(UCLIBC_DIR)/Config: $(SOURCE_DIR)/$(UCLIBC_SOURCE) - tar -xzf $(SOURCE_DIR)/$(UCLIBC_SOURCE) + rm -rf $(UCLIBC_DIR) # Make sure no previous version interferes here + gzip -d -c $(SOURCE_DIR)/$(UCLIBC_SOURCE) | tar xf - + # The next step patches uClibc + # Place patches in the source directory, named uClibc-*.patch for p in `find $(SOURCE_DIR) -name uClibc-*.patch | sort -g`;do \ patch -p0 < $$p ; \ done - -f $(SOURCE_DIR)/uClibc-Config.awk < \ - $(UCLIBC_DIR)/extra/Configs/Config.$(ARCH) > $(UCLIBC_DIR)/Config; + # Finally, patch the Config file to our liking + # uClibc-Config.awk should be pretty staightforward + awk -f $(SOURCE_DIR)/uClibc-Config.awk < \ + $(UCLIBC_DIR)/extra/Configs/Config.$(ARCH) > \ + $(UCLIBC_DIR)/Config -$(UCLIBC_DIR)/lib/libc.a: $(STAGING_DIR)/.i_exist $(LINUX_DIR)/.dep $(UCLIBC_DIR)/Config +$(UCLIBC_DIR)/lib/libc.a: $(LINUX_DIR)/.dep $(UCLIBC_DIR)/Config $(MAKE) CROSS=$(CROSS) \ DEVEL_PREFIX=$(STAGING_DIR) \ SYSTEM_DEVEL_PREFIX=$(STAGING_DIR)/usr \ @@ -166,7 +175,7 @@ $(TARGET_CC): $(UCLIBC_DIR)/lib/libc.a SHARED_LIB_LOADER_PATH=$(STAGING_DIR)/lib \ -C $(UCLIBC_DIR) install -$(UCLIBC_DIR)/.installed_runtime: $(TARGET_CC) +$(UCLIBC_DIR)/.installed_runtime: $(STAGING_DIR)/.target_dir_exists $(TARGET_CC) $(MAKE) CROSS=$(CROSS) \ PREFIX=$(TARGET_DIR) \ DEVEL_PREFIX=/ \ diff --git a/boa.mk b/boa.mk index 00d27d61f7..6b8b1b75c7 100644 --- a/boa.mk +++ b/boa.mk @@ -34,12 +34,9 @@ $(BOA_WORKDIR)/Makefile: $(TARGET_CC) $(BOA_DIR)/.unpacked (cd $(BOA_WORKDIR) && CC=$(TARGET_CC) $(BOA_DIR)/src/configure); \ fi touch $(BOA_WORKDIR)/.depend - touch $(BOA_WORKDIR)/.unpacked -$(BOA_WORKDIR)/boa: $(BOA_WORKDIR)/Makefile - make VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR) - -$(BOA_WORKDIR)/boa_indexer: $(BOA_WORKDIR)/Makefile +$(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer: $(BOA_WORKDIR)/Makefile + rm -f $@ make VPATH=$(BOA_DIR)/src/ -C $(BOA_WORKDIR) $(BOA_WORKDIR)/.installed: $(BOA_WORKDIR)/boa $(BOA_WORKDIR)/boa_indexer diff --git a/busybox.mk b/busybox.mk index e53af6f1ad..25a22c7db6 100644 --- a/busybox.mk +++ b/busybox.mk @@ -21,11 +21,12 @@ $(SOURCE_DIR)/$(BUSYBOX_SOURCE): done $(BUSYBOX_DIR)/.unpacked: $(SOURCE_DIR)/$(BUSYBOX_SOURCE) + rm -rf $(BUSYBOX_DIR) # Make sure no older version interferes tar -xzf $(SOURCE_DIR)/$(BUSYBOX_SOURCE) touch $(BUSYBOX_DIR)/.unpacked $(BUSYBOX_WORKDIR)/.config: $(BUSYBOX_DIR)/.unpacked - rm -rf $(BUSYBOX_WORKDIR) + rm -rf $(BUSYBOX_WORKDIR) # Make sure no half-configured busybox interferes mkdir -p $(BUSYBOX_WORKDIR) (cd $(BUSYBOX_WORKDIR) && sh $(BUSYBOX_DIR)/pristine_setup.sh) @perl -i -p \ @@ -40,13 +41,12 @@ $(BUSYBOX_WORKDIR)/.config: $(BUSYBOX_DIR)/.unpacked $(BUSYBOX_WORKDIR)/Config.h touch $(BUSYBOX_WORKDIR)/.config -$(BUSYBOX_WORKDIR)/busybox: $(TARGET_CC) $(BUSYBOX_WORKDIR)/.config - rm -f $(BUSYBOX_WORKDIR)/busybox +$(BUSYBOX_WORKDIR)/.built: $(TARGET_CC) $(BUSYBOX_WORKDIR)/.config make CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_WORKDIR) + touch $(BUSYBOX_WORKDIR)/.built -$(TARGET_DIR)/bin/busybox: $(BUSYBOX_WORKDIR)/busybox - make CROSS="$(TARGET_CROSS)" PREFIX=$(TARGET_DIR) \ - -C $(BUSYBOX_WORKDIR) install +$(TARGET_DIR)/bin/busybox: $(BUSYBOX_WORKDIR)/.built + make PREFIX=$(TARGET_DIR) -C $(BUSYBOX_WORKDIR) install busybox: $(TARGET_DIR)/bin/busybox -- 2.30.2