home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / trees / syslinux-1.40 / Makefile < prev    next >
Encoding:
Makefile  |  1998-05-07  |  3.7 KB  |  127 lines

  1. ## -----------------------------------------------------------------------
  2. ##  $Id: Makefile,v 1.23 1998/05/07 23:47:23 hpa Exp $
  3. ##
  4. ##   Copyright 1998 H. Peter Anvin - All Rights Reserved
  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., 675 Mass Ave, Cambridge MA 02139,
  9. ##   USA; either version 2 of the License, or (at your option) any later
  10. ##   version; incorporated herein by reference.
  11. ##
  12. ## -----------------------------------------------------------------------
  13.  
  14. #
  15. # Main Makefile for SYSLINUX
  16. #
  17.  
  18. NASM    = nasm
  19. CC    = gcc
  20. CFLAGS    = -Wall -O2 -fomit-frame-pointer
  21. LDFLAGS    = -O2 -s
  22.  
  23. BINDIR  = /usr/bin
  24.  
  25. VERSION = $(shell cat version)
  26.  
  27. .c.o:
  28.     $(CC) $(CFLAGS) -c $<
  29.  
  30. SOURCES = ldlinux.asm syslinux.asm syslinux.c copybs.asm
  31. TARGETS = bootsect.bin ldlinux.sys syslinux.com syslinux copybs.com
  32. DOCS    = COPYING NEWS README TODO syslinux.doc keytab-lilo.doc
  33. OTHER   = Makefile bin2c.pl now.pl genstupid.pl keytab-lilo.pl version
  34.  
  35. all:    $(TARGETS)
  36.     ls -l $(TARGETS)
  37.  
  38. # The DATE is set on the make command line when building binaries for
  39. # official release.  Otherwise, substitute a hex string that is pretty much
  40. # guaranteed to be unique to be unique from build to build.
  41. ifndef HEXDATE
  42. HEXDATE = $(shell perl now.pl ldlinux.asm)
  43. endif
  44. ifndef DATE
  45. DATE = $(HEXDATE)
  46. endif
  47.  
  48. ldlinux.bin: ldlinux.asm genstupid.pl
  49.     $(NASM) -f bin -dVERSION="'$(VERSION)'" -dDATE_STR="'$(DATE)'" -dHEXDATE="$(HEXDATE)" -l ldlinux.lst -o ldlinux.bin ldlinux.asm
  50.     perl genstupid.pl < ldlinux.lst
  51.  
  52. bootsect.bin: ldlinux.bin
  53.     dd if=ldlinux.bin of=bootsect.bin bs=512 count=1
  54.  
  55. ldlinux.sys: ldlinux.bin
  56.     dd if=ldlinux.bin of=ldlinux.sys  bs=512 skip=1
  57.  
  58. syslinux.com: syslinux.asm bootsect.bin ldlinux.sys stupid.inc
  59.     $(NASM) -f bin -l syslinux.lst -o syslinux.com syslinux.asm
  60.  
  61. copybs.com: copybs.asm
  62.     $(NASM) -f bin -l copybs.lst -o copybs.com copybs.asm
  63.  
  64. bootsect_bin.c: bootsect.bin bin2c.pl
  65.     perl bin2c.pl bootsect < bootsect.bin > bootsect_bin.c
  66.  
  67. ldlinux_bin.c: ldlinux.sys bin2c.pl
  68.     perl bin2c.pl ldlinux < ldlinux.sys > ldlinux_bin.c
  69.  
  70. syslinux: syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
  71.     $(CC) $(LDFLAGS) -o syslinux \
  72.         syslinux.o bootsect_bin.o ldlinux_bin.o stupid.o
  73.  
  74. stupid.o: stupid.c
  75.  
  76. stupid.c: ldlinux.asm
  77.  
  78. stupid.inc: ldlinux.asm
  79.  
  80. install: all
  81.     install -c syslinux $(BINDIR)
  82.  
  83. tidy:
  84.     rm -f ldlinux.bin *.lst *.o *_bin.c stupid.*
  85.  
  86. clean: tidy
  87.     rm -f $(TARGETS)
  88.  
  89. dist: tidy
  90.     rm -f *~ \#*
  91.  
  92. #
  93. # This should only be used by the maintainer to generate official binaries
  94. # for release.  Please do not "make official" and distribute the binaries,
  95. # please.
  96. #
  97. .PHONY: official release
  98.  
  99. official:
  100.     $(MAKE) clean
  101.     $(MAKE) all DATE=`date +'%Y-%m-%d'`
  102.     $(MAKE) dist
  103.  
  104. release:
  105.     -rm -rf release/syslinux-$(VERSION)
  106.     -rm -f release/syslinux-$(VERSION).*
  107.     mkdir -p release/syslinux-$(VERSION)
  108.     cp $(SOURCES) $(DOCS) $(OTHER) release/syslinux-$(VERSION)
  109.     make -C release/syslinux-$(VERSION) official
  110.     cd release ; tar cvvf - syslinux-$(VERSION) | \
  111.         gzip -9 > syslinux-$(VERSION).tar.gz
  112.     cd release/syslinux-$(VERSION) ; \
  113.         zip -9r ../syslinux-$(VERSION).zip *
  114.  
  115. prerel:
  116.     -rm -rf release/syslinux-$(VERSION)-$(DATE)
  117.     -rm -f release/syslinux-$(VERSION)-$(DATE).*
  118.     mkdir -p release/syslinux-$(VERSION)-$(DATE)
  119.     cp $(SOURCES) $(DOCS) $(OTHER) release/syslinux-$(VERSION)-$(DATE)
  120.     make -C release/syslinux-$(VERSION)-$(DATE) clean
  121.     make -C release/syslinux-$(VERSION)-$(DATE) HEXDATE="$(DATE)"
  122.     make -C release/syslinux-$(VERSION)-$(DATE) dist
  123.     cd release ; tar cvvf - syslinux-$(VERSION)-$(DATE) | \
  124.         gzip -9 > syslinux-$(VERSION)-$(DATE).tar.gz
  125.     cd release/syslinux-$(VERSION)-$(DATE) ; \
  126.         zip -9r ../syslinux-$(VERSION)-$(DATE).zip *
  127.