Adding upstream version 4.00~pre61+dfsg.
[syslinux-debian/hramrach.git] / com32 / hdt / Makefile
blob96af05f61fc07aed88253477016cec4604e6a535
1 ## -----------------------------------------------------------------------
2 ##
3 ## Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
4 ## Copyright 2009 Intel Corporation; author: H. Peter Anvin
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
9 ## Boston MA 02110-1301, USA; either version 2 of the License, or
10 ## (at your option) any later version; incorporated herein by reference.
12 ## -----------------------------------------------------------------------
15 ## Hardware Detection Tool
18 topdir = ../..
19 include ../MCONFIG
21 LIBS = ../cmenu/libmenu/libmenu.a ../libutil/libutil_com.a \
22 ../lib/libcom32.a $(LIBGCC)
23 CFLAGS += -I$(com32)/cmenu/libmenu
25 MODULES = hdt.c32
26 TESTFILES =
28 OBJS = $(patsubst %.c,%.o,$(wildcard *.c))
29 VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h)
30 CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h)
31 VERSION_C32 = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g')
33 MEMTEST_URL = http://memtest.org/download/4.10/memtest86+-4.10.bin
34 MEMTEST = memtest.bin
36 KERNEL_VERSION ?= $(shell uname -r)
37 MODULES_ALIAS_FILE ?= /lib/modules/$(KERNEL_VERSION)/modules.alias
38 GZ_MODULES_ALIAS_FILE ?= modules.alias.gz
39 MODULES_PCIMAP_FILE ?= /lib/modules/$(KERNEL_VERSION)/modules.pcimap
40 GZ_MODULES_PCIMAP_FILE ?= modules.pcimap.gz
41 ISO_DIR ?= iso
42 ISOLINUX_DIR ?= isolinux
43 FLOPPY_DIR ?= floppy
44 PCI_IDS_FILE ?= $(PWD)/$(FLOPPY_DIR)/pci.ids
45 GZ_PCI_IDS_FILE ?= $(PCI_IDS_FILE).gz
46 MENU_COM32 ?= $(com32)/menu/menu.c32
47 ART_DIR ?= art/
49 all: $(MODULES) $(TESTFILES)
51 hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
52 $(LD) $(LDFLAGS) -o $@ $^
54 memtest:
55 -[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
57 hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(MENU_COM32) memtest
58 rm -f hdt*.img
59 $(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
60 $(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(FLOPPY_DIR)/syslinux.cfg
61 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MFORMAT) -v HDT_$(VERSION) -f 1440 -C a:
62 $(topdir)/mtools/syslinux hdt.img
63 -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
64 -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
65 -[ -f $(MODULES_ALIAS_FILE) ] && cat $(MODULES_ALIAS_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:modules.alias
66 -[ -f $(MODULES_PCIMAP_FILE) ] && cat $(MODULES_PCIMAP_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:modules.pcimap
67 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) hdt.c32 a:
68 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MENU_COM32) a:
69 @ [ -f $(GZ_PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(GZ_PCI_IDS_FILE) a:pci.ids || printf "\nThe $(GZ_PCI_IDS_FILE) file is missing and can be downloaded from http://pciids.sourceforge.net and gzipped in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n"
70 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/syslinux.cfg a:
71 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/$(MEMTEST) a:
72 MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(ART_DIR)/backgnd.png a:
73 mv hdt.img hdt-$(VERSION).img
74 ln -sf hdt-$(VERSION).img hdt.img
76 hdt.img.gz: hdt.img
77 rm -rf hdt*.img.gz
78 $(GZIPPROG) -c hdt-$(VERSION).img >hdt-$(VERSION).img.gz
79 ln -sf hdt-$(VERSION).img.gz hdt.img.gz
81 hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
82 rm -rf $(ISO_DIR)
83 rm -f hdt.iso
84 mkdir -p $(ISO_DIR)/$(ISOLINUX_DIR)
85 cp $(topdir)/core/isolinux.bin $(ISO_DIR)/$(ISOLINUX_DIR)
86 $(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
87 $(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg
88 cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR)
89 cp $(FLOPPY_DIR)/$(MEMTEST) $(ISO_DIR)/$(ISOLINUX_DIR)
90 cp $(MENU_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
91 cp -av $(ART_DIR)/backgnd.png $(ISO_DIR)/$(ISOLINUX_DIR)
92 -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
93 -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIPPROG) $(PCI_IDS_FILE)
94 -[ -f $(MODULES_ALIAS_FILE) ] && cp $(MODULES_ALIAS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\
95 && $(GZIPPROG) $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias\
96 && mv $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias.gz $(ISO_DIR)/$(ISOLINUX_DIR)/modules.alias
97 -[ -f $(MODULES_PCIMAP_FILE) ] && cp $(MODULES_PCIMAP_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\
98 && $(GZIPPROG) $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap\
99 && mv $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap.gz $(ISO_DIR)/$(ISOLINUX_DIR)/modules.pcimap
100 -[ ! -f $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids.gz ] && cp $(GZ_PCI_IDS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids
101 -[ ! -f $(ISO_DIR)/$(ISOLINUX_DIR)/pci.ids ] && printf "\nThe $(FLOPPY_DIR)/pci.ids file is missing and can be downloaded from http://pciids.sourceforge.net and put in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n"
102 $(MKISOFS) -o hdt.iso -b $(ISOLINUX_DIR)/isolinux.bin -c $(ISOLINUX_DIR)/boot.cat \
103 -no-emul-boot -boot-load-size 4 -boot-info-table \
104 $(ISO_DIR)
105 mv hdt.iso hdt-$(VERSION).iso
106 ln -sf hdt-$(VERSION).iso hdt.iso
108 release: spotless hdt.c32 hdt.img hdt.img.gz hdt.iso
109 mv hdt.c32 hdt_$(VERSION_C32).c32
111 tidy dist:
112 rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
114 clean: tidy
115 rm -f *.lnx
117 spotless: clean
118 rm -f *.lss *.c32 *.com hdt*.img hdt*.iso hdt*.img.gz
119 rm -rf $(ISO_DIR)
120 rm -rf $(FLOPPY_DIR)/memtest
121 rm -rf $(FLOPPY_DIR)/pci.ids*
122 rm -f *~ \#*
124 install:
126 -include .*.d