--- trunk/mkinitrd-magellan/isolinux/Makefile 2007/09/01 23:07:53 537 +++ trunk/mkinitrd-magellan/isolinux/Makefile 2010/08/19 09:50:43 1133 @@ -1,7 +1,7 @@ -## $Id: Makefile,v 1.2 2007-09-01 23:07:53 niro Exp $ ## ----------------------------------------------------------------------- -## -## Copyright 1998-2005 H. Peter Anvin - All Rights Reserved +## +## Copyright 1998-2009 H. Peter Anvin - All Rights Reserved +## Copyright 2009 Intel Corporation; author: H. Peter Anvin ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -12,51 +12,79 @@ ## ----------------------------------------------------------------------- # -# Main Makefile for SYSLINUX +# Makefile for the SYSLINUX core # -OSTYPE = $(shell uname -msr) -CC = gcc -INCLUDE = -CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -PIC = -fPIC -LDFLAGS = -O2 -s -AR = ar -RANLIB = ranlib -NASM = nasm -O99 -PERL = perl - -VERSION = $(shell cat version) -MKINITRD_VERSION = $(shell cat ../VERSION) - -DOCS = COPYING NEWS README TODO BUGS isolinux.doc - -LIBDIR = /usr/lib/mkinitrd -DOCDIR = /usr/share/doc/mkinitrd-$(MKINITRD_VERSION)/isolinux - +# No builtin rules +MAKEFLAGS += -r +MAKE += -r + +topdir = . +include $(topdir)/MCONFIG.embedded +-include $(topdir)/version.mk + +OPTFLAGS = +INCLUDES = + +# The targets to build in this directory... +BTARGET = kwdhash.gen isolinux.bin + +# All primary source files for the main syslinux files +NASMSRC = $(wildcard *.asm) +NASMHDR = $(wildcard *.inc) +CSRC = $(wildcard *.c) +CHDR = $(wildcard *.h) +OTHERSRC = keywords +ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(CHDR) $(OTHERSRC) # The DATE is set on the make command line when building binaries for # official release. Otherwise, substitute a hex string that is pretty much # guaranteed to be unique to be unique from build to build. ifndef HEXDATE -HEXDATE := $(shell $(PERL) now.pl ldlinux.asm pxelinux.asm isolinux.asm) +HEXDATE := $(shell $(PERL) now.pl $(SRCS)) endif ifndef DATE -DATE := $(HEXDATE) +DATE := $(shell sh gen-id.sh $(VERSION) $(HEXDATE)) endif -MAKE += DATE=$(DATE) HEXDATE=$(HEXDATE) -isolinux.bin: isolinux.asm kwdhash.gen version.gen checksumiso.pl - $(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \ - -DMAP=$(@:.bin=.map) -l $(@:.bin=.lst) -o $@ $< - $(PERL) checkov.pl $(@:.bin=.map) $@ +all: $(BTARGET) + +kwdhash.gen: keywords genhash.pl + $(PERL) genhash.pl < keywords > kwdhash.gen + +.PRECIOUS: %.elf + +# Standard rule for {isolinux,isolinux-debug}.bin +iso%.bin: iso%.elf checksumiso.pl + $(OBJCOPY) -O binary $< $@ $(PERL) checksumiso.pl $@ -install: - mkdir -p $(DESTDIR)/$(LIBDIR) - mkdir -p $(DESTDIR)/$(DOCDIR) - install -m755 -c isolinux.bin $(DESTDIR)/$(LIBDIR) - for n in $(DOCS); do install -m644 $$n $(DESTDIR)/$(DOCDIR); done +%.o: %.asm kwdhash.gen version.gen + ( $(NASM) -M -DDEPEND $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d; true + $(NASM) $(NASMOPT) -f elf -g -F stabs -DDATE_STR="'$(DATE)'" \ + -DHEXDATE="$(HEXDATE)" \ + -l $(@:.o=.lsr) -o $@ $< + +%.elf: %.o syslinux.ld + $(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< > $(@:.elf=.map) + $(OBJDUMP) -h $@ > $(@:.elf=.sec) + $(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst) + +install: installer + +install-lib: installer + +install-all: install install-lib + +netinstall: installer + +tidy dist: + rm -f codepage.cp *.o *.elf stupid.* patch.offset .depend .*.d + rm -f *.lsr *.lst *.map *.sec + rm -f $(OBSOLETE) + rm -f $(BTARGET) *.bin *_bin.c + +clean: tidy -clean: - for i in isolinux.bin isolinux.lst isolinux.map; do rm -rf $$i; done +# Include dependencies file +-include .*.d