|
## $Id: Makefile,v 1.2 2007-09-01 23:07:53 niro Exp $ |
|
1 |
## ----------------------------------------------------------------------- |
## ----------------------------------------------------------------------- |
2 |
## |
## |
3 |
## Copyright 1998-2005 H. Peter Anvin - All Rights Reserved |
## Copyright 1998-2009 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 |
## 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 |
## it under the terms of the GNU General Public License as published by |
12 |
## ----------------------------------------------------------------------- |
## ----------------------------------------------------------------------- |
13 |
|
|
14 |
# |
# |
15 |
# Main Makefile for SYSLINUX |
# Makefile for the SYSLINUX core |
16 |
# |
# |
17 |
|
|
18 |
OSTYPE = $(shell uname -msr) |
# No builtin rules |
19 |
CC = gcc |
MAKEFLAGS += -r |
20 |
INCLUDE = |
MAKE += -r |
21 |
CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 |
|
22 |
PIC = -fPIC |
topdir = . |
23 |
LDFLAGS = -O2 -s |
include $(topdir)/MCONFIG.embedded |
24 |
AR = ar |
-include $(topdir)/version.mk |
25 |
RANLIB = ranlib |
|
26 |
NASM = nasm -O99 |
OPTFLAGS = |
27 |
PERL = perl |
INCLUDES = |
28 |
|
|
29 |
VERSION = $(shell cat version) |
# The targets to build in this directory... |
30 |
MKINITRD_VERSION = $(shell cat ../VERSION) |
BTARGET = kwdhash.gen isolinux.bin |
31 |
|
|
32 |
DOCS = COPYING NEWS README TODO BUGS isolinux.doc |
# All primary source files for the main syslinux files |
33 |
|
NASMSRC = $(wildcard *.asm) |
34 |
LIBDIR = /usr/lib/mkinitrd |
NASMHDR = $(wildcard *.inc) |
35 |
DOCDIR = /usr/share/doc/mkinitrd-$(MKINITRD_VERSION)/isolinux |
CSRC = $(wildcard *.c) |
36 |
|
CHDR = $(wildcard *.h) |
37 |
|
OTHERSRC = keywords |
38 |
|
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(CHDR) $(OTHERSRC) |
39 |
|
|
40 |
# The DATE is set on the make command line when building binaries for |
# The DATE is set on the make command line when building binaries for |
41 |
# official release. Otherwise, substitute a hex string that is pretty much |
# official release. Otherwise, substitute a hex string that is pretty much |
42 |
# guaranteed to be unique to be unique from build to build. |
# guaranteed to be unique to be unique from build to build. |
43 |
ifndef HEXDATE |
ifndef HEXDATE |
44 |
HEXDATE := $(shell $(PERL) now.pl ldlinux.asm pxelinux.asm isolinux.asm) |
HEXDATE := $(shell $(PERL) now.pl $(SRCS)) |
45 |
endif |
endif |
46 |
ifndef DATE |
ifndef DATE |
47 |
DATE := $(HEXDATE) |
DATE := $(shell sh gen-id.sh $(VERSION) $(HEXDATE)) |
48 |
endif |
endif |
|
MAKE += DATE=$(DATE) HEXDATE=$(HEXDATE) |
|
49 |
|
|
50 |
isolinux.bin: isolinux.asm kwdhash.gen version.gen checksumiso.pl |
all: $(BTARGET) |
51 |
$(NASM) -f bin -DDATE_STR="'$(DATE)'" -DHEXDATE="$(HEXDATE)" \ |
|
52 |
-DMAP=$(@:.bin=.map) -l $(@:.bin=.lst) -o $@ $< |
kwdhash.gen: keywords genhash.pl |
53 |
$(PERL) checkov.pl $(@:.bin=.map) $@ |
$(PERL) genhash.pl < keywords > kwdhash.gen |
54 |
|
|
55 |
|
.PRECIOUS: %.elf |
56 |
|
|
57 |
|
# Standard rule for {isolinux,isolinux-debug}.bin |
58 |
|
iso%.bin: iso%.elf checksumiso.pl |
59 |
|
$(OBJCOPY) -O binary $< $@ |
60 |
$(PERL) checksumiso.pl $@ |
$(PERL) checksumiso.pl $@ |
61 |
|
|
62 |
install: |
%.o: %.asm kwdhash.gen version.gen |
63 |
mkdir -p $(DESTDIR)/$(LIBDIR) |
( $(NASM) -M -DDEPEND $(NINCLUDE) -o $@ $< ; echo '' ) > .$@.d; true |
64 |
mkdir -p $(DESTDIR)/$(DOCDIR) |
$(NASM) $(NASMOPT) -f elf -g -F stabs -DDATE_STR="'$(DATE)'" \ |
65 |
install -m755 -c isolinux.bin $(DESTDIR)/$(LIBDIR) |
-DHEXDATE="$(HEXDATE)" \ |
66 |
for n in $(DOCS); do install -m644 $$n $(DESTDIR)/$(DOCDIR); done |
-l $(@:.o=.lsr) -o $@ $< |
67 |
|
|
68 |
|
%.elf: %.o syslinux.ld |
69 |
|
$(LD) $(LDFLAGS) -T syslinux.ld -M -o $@ $< > $(@:.elf=.map) |
70 |
|
$(OBJDUMP) -h $@ > $(@:.elf=.sec) |
71 |
|
$(PERL) lstadjust.pl $(@:.elf=.lsr) $(@:.elf=.sec) $(@:.elf=.lst) |
72 |
|
|
73 |
|
install: installer |
74 |
|
|
75 |
|
install-lib: installer |
76 |
|
|
77 |
|
install-all: install install-lib |
78 |
|
|
79 |
|
netinstall: installer |
80 |
|
|
81 |
|
tidy dist: |
82 |
|
rm -f codepage.cp *.o *.elf stupid.* patch.offset .depend .*.d |
83 |
|
rm -f *.lsr *.lst *.map *.sec |
84 |
|
rm -f $(OBSOLETE) |
85 |
|
rm -f $(BTARGET) *.bin *_bin.c |
86 |
|
|
87 |
|
clean: tidy |
88 |
|
|
89 |
clean: |
# Include dependencies file |
90 |
for i in isolinux.bin isolinux.lst isolinux.map; do rm -rf $$i; done |
-include .*.d |