Fix the various '-clean' targets so that they don't fail if the source has not
[buildrom.git] / buildrom-devel / packages / etherboot / etherboot.mk
blobd5fcb9a1b42e5140758a01f240419e77ae4b34c2
1 ETHERBOOT_URL=http://internap.dl.sourceforge.net/sourceforge/etherboot
2 ETHERBOOT_SOURCE=etherboot-5.4.3.tar.bz2
3 ETHERBOOT_DIR=$(BUILD_DIR)/etherboot
4 ETHERBOOT_SRC_DIR=$(ETHERBOOT_DIR)/etherboot-5.4.3/src
5 ETHERBOOT_STAMP_DIR=$(ETHERBOOT_DIR)/stamps
6 ETHERBOOT_LOG_DIR=$(ETHERBOOT_DIR)/logs
8 ETHERBOOT_PATCHES += $(PACKAGE_DIR)/etherboot/patches/fix-realmode-stack.patch
10 # Filter the quotes off the config string
11 ETHERBOOT_DRIVER := $(shell echo $(CONFIG_ETHERBOOT_DRIVER) | sed -e s:\"::g)
12 ETHERBOOT_OUTPUT=$(ETHERBOOT_SRC_DIR)/bin/$(ETHERBOOT_DRIVER).zelf
14 ifeq ($(CONFIG_VERBOSE),y)
15 ETHERBOOT_BUILD_LOG=/dev/stdout
16 ETHERBOOT_INSTALL_LOG=/dev/stdout
17 else
18 ETHERBOOT_BUILD_LOG=$(ETHERBOOT_LOG_DIR)/build.log
19 ETHERBOOT_INSTALL_LOG=$(ETHERBOOT_LOG_DIR)/install.log
20 endif
22 $(SOURCE_DIR)/$(ETHERBOOT_SOURCE):
23 @ mkdir -p $(SOURCE_DIR)
24 @ wget -P $(SOURCE_DIR) $(ETHERBOOT_URL)/$(ETHERBOOT_SOURCE)
26 $(ETHERBOOT_STAMP_DIR)/.unpacked: $(SOURCE_DIR)/$(ETHERBOOT_SOURCE)
27 @ echo "Unpacking etherboot..."
28 @ tar -C $(ETHERBOOT_DIR) -jxf $(SOURCE_DIR)/$(ETHERBOOT_SOURCE)
29 @ touch $@
31 $(ETHERBOOT_STAMP_DIR)/.patched: $(ETHERBOOT_STAMP_DIR)/.unpacked
32 @ echo "Patching etherboot..."
33 @ $(BIN_DIR)/doquilt.sh $(ETHERBOOT_SRC_DIR)/.. $(ETHERBOOT_PATCHES)
34 @ touch $@
36 $(ETHERBOOT_STAMP_DIR)/.configured: $(ETHERBOOT_STAMP_DIR)/.patched
37 @ cp $(PACKAGE_DIR)/etherboot/conf/Config.main \
38 $(ETHERBOOT_SRC_DIR)/Config
39 @ cp $(PACKAGE_DIR)/etherboot/conf/Config.$(ETHERBOOT_ARCH) \
40 $(ETHERBOOT_SRC_DIR)/arch/$(ETHERBOOT_ARCH)/Config
41 @ touch $@
43 $(ETHERBOOT_OUTPUT): $(ETHERBOOT_STAMP_DIR)/.configured
44 @ echo "Building etherboot..."
45 @ ( unset CFLAGS; export EXTRA_CFLAGS="$(CFLAGS)"; \
46 unset ASFLAGS; export EXTRA_ASFLAGS="$(ASFLAGS)"; \
47 unset LDFLAGS; \
48 $(MAKE) -C $(ETHERBOOT_SRC_DIR) ARCH=$(ETHERBOOT_ARCH) \
49 bin/$(ETHERBOOT_DRIVER).zelf > $(ETHERBOOT_BUILD_LOG) 2>&1)
51 $(ETHERBOOT_STAMP_DIR) $(ETHERBOOT_LOG_DIR):
52 @ mkdir -p $@
54 etherboot: $(ETHERBOOT_STAMP_DIR) $(ETHERBOOT_LOG_DIR) $(ETHERBOOT_OUTPUT)
55 @ mkdir -p $(OUTPUT_DIR)
56 @ cp $(ETHERBOOT_OUTPUT) $(PAYLOAD_ELF)
58 etherboot-clean:
59 @ echo "Cleaning etherboot..."
60 ifneq ($(wildcard "$(ETHERBOOT_SRC_DIR)/Makefile"),)
61 @ $(MAKE) -C $(ETHERBOOT_SRC_DIR) clean > /dev/null 2>&1
62 endif
64 etherboot-distclean:
65 @ rm -rf $(ETHERBOOT_DIR)/*