From 0596155be3f9cc9d3eb385497ee79935c69ec042 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 29 May 2008 17:53:42 -0700 Subject: [PATCH] Centralize configurables; better "make install" etc Begin the process of centralizing configurables. Improve "make install" and "make netinstall"; add "make extbootinstall". --- MCONFIG | 50 +++++++++++++++++++++++++++++++ Makefile | 80 +++++++++++++++++--------------------------------- NEWS | 5 ++++ com32/lib/MCONFIG | 13 ++------ com32/lib/Makefile | 3 +- com32/libutil/Makefile | 3 +- com32/menu/Makefile | 3 +- com32/modules/Makefile | 3 +- com32/samples/Makefile | 1 - syslinux.spec.in | 30 +++++-------------- utils/Makefile | 24 +++++---------- 11 files changed, 107 insertions(+), 108 deletions(-) create mode 100644 MCONFIG diff --git a/MCONFIG b/MCONFIG new file mode 100644 index 0000000..09764c8 --- /dev/null +++ b/MCONFIG @@ -0,0 +1,50 @@ +## -*- makefile -*- ------------------------------------------------------- +## +## Copyright 2008 H. Peter Anvin - All Rights Reserved +## +## 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 +## the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, +## Boston MA 02110-1301, USA; either version 2 of the License, or +## (at your option) any later version; incorporated herein by reference. +## +## ----------------------------------------------------------------------- + +## +## Common configurables +## + +# No builtin rules +MAKEFLAGS += -r +MAKE += -r + +BINDIR = /usr/bin +SBINDIR = /sbin +LIBDIR = /usr/lib +DATADIR = /usr/share +AUXDIR = $(DATADIR)/syslinux +MANDIR = /usr/man +INCDIR = /usr/include +TFTPBOOT = /tftpboot + +BOOTDIR = /boot +EXTLINUXDIR = $(BOOTDIR)/extlinux + +NASM = nasm +NASMOPT = -O9999 + +PERL = perl + +CC = gcc +TMPFILE := $(shell mktemp /tmp/gcc_ok.XXXXXX) +gcc_ok = $(shell tmpf=$(TMPFILE); \ + if $(CC) $(1) -c $(topdir)/dummy.c -o $$tmpf 2>/dev/null ; \ + then echo '$(1)'; else echo '$(2)'; fi; \ + rm -f $$tmpf) + +LD = ld +OBJDUMP = objdump +OBJCOPY = objcopy +AR = ar +NM = nm +RANLIB = ranlib diff --git a/Makefile b/Makefile index 1b208c7..e436489 100644 --- a/Makefile +++ b/Makefile @@ -13,49 +13,10 @@ # # Main Makefile for SYSLINUX # +topdir = . +include $(topdir)/MCONFIG -# No builtin rules -MAKEFLAGS += -r -MAKE += -r - -TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) - -CC = gcc - -gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \ - then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf) - -comma := , -LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) - -OSTYPE = $(shell uname -msr) -INCLUDE = -CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -PIC = -fPIC -LDFLAGS = -O2 -s $(LDHASH) -AR = ar -RANLIB = ranlib -LD = ld -OBJCOPY = objcopy -OBJDUMP = objdump - -NASM = nasm -NASMOPT = -O9999 -NINCLUDE = -BINDIR = /usr/bin -SBINDIR = /sbin -LIBDIR = /usr/lib -AUXDIR = $(LIBDIR)/syslinux -MANDIR = /usr/man -INCDIR = /usr/include -TFTPBOOT = /tftpboot - -PERL = perl - -VERSION = $(shell cat version) - -%.o: %.c - $(CC) $(INCLUDE) $(CFLAGS) -c $< +VERSION := $(shell cat version) # # The BTARGET refers to objects that are derived from ldlinux.asm; we @@ -87,16 +48,28 @@ IESUBDIRS = ISUBDIRS = mtools linux extlinux utils com32 sample # Things to install in /usr/bin -INSTALL_BIN = mtools/syslinux utils/gethostip utils/ppmtolss16 \ - utils/lss16toppm utils/sha1pass utils/md5pass +INSTALL_BIN = mtools/syslinux # Things to install in /sbin INSTALL_SBIN = extlinux/extlinux # Things to install in /usr/lib/syslinux INSTALL_AUX = core/pxelinux.0 gpxe/gpxelinux.0 core/isolinux.bin \ core/isolinux-debug.bin \ - dos/syslinux.com dos/copybs.com memdisk/memdisk mbr/mbr.bin + dos/syslinux.com dos/copybs.com win32/syslinux.exe \ + memdisk/memdisk memdump/memdump.com \ + mbr/mbr.bin mbr/gptmbr.bin INSTALL_AUX_OPT = win32/syslinux.exe +# These directories manage their own installables +INSTALLSUBDIRS = com32 utils + +# Things to install in /boot/extlinux +EXTBOOTINSTALL = memdisk/memdisk memdump/memdump.com \ + com32/menu/*.c32 com32/modules/*.c32 + +# Things to install in /tftpboot +NETINSTALLABLE = core/pxelinux.0 gpxe/gpxelinux.0 memdisk/memdisk \ + memdump/memdump.com com32/menu/*.c32 com32/modules/*.c32 + all: set -e ; for i in $(BESUBDIRS) $(IESUBDIRS) ; do $(MAKE) -C $$i $@ ; done $(MAKE) all-local @@ -119,7 +92,7 @@ version.gen: version version.pl version.h: version version.pl $(PERL) version.pl $< $@ '#define' -install: installer +local-install: installer mkdir -m 755 -p $(INSTALLROOT)$(BINDIR) install -m 755 -c $(INSTALL_BIN) $(INSTALLROOT)$(BINDIR) mkdir -m 755 -p $(INSTALLROOT)$(SBINDIR) @@ -131,19 +104,20 @@ install: installer install -m 644 -c man/*.1 $(INSTALLROOT)$(MANDIR)/man1 : mkdir -m 755 -p $(INSTALLROOT)$(MANDIR)/man8 : install -m 644 -c man/*.8 $(INSTALLROOT)$(MANDIR)/man8 - $(MAKE) -C com32 install -install-lib: installer - -install-all: install install-lib - -NETINSTALLABLE = pxelinux.0 gpxelinux.0 memdisk/memdisk memdump/memdump.com \ - com32/menu/*.c32 com32/modules/*.c32 +install: local-install + set -e ; for i in $(INSTALLSUBDIRS) ; do $(MAKE) -C $$i $@ ; done netinstall: installer mkdir -p $(INSTALLROOT)$(TFTPBOOT) install -m 644 $(NETINSTALLABLE) $(INSTALLROOT)$(TFTPBOOT) +extbootinstall: installer + mkdir -m 755 -p $(INSTALLROOT)$(EXTLINUXDIR) + install -m 644 $(EXTBOOTINSTALL) $(INSTALLROOT)$(EXTLINUXDIR) + +install-all: install netinstall extbootinstall + local-tidy: rm -f *.o *.elf *_bin.c stupid.* patch.offset rm -f *.lsr *.lst *.map *.sec diff --git a/NEWS b/NEWS index 989c79b..bdda87c 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,11 @@ Changes in 3.70: * The source tree has been restructured; files that were previously in the root have moved into the core, dos, gpxe, and utils directories. + * "make install", "make netinstall", and "make extbootinstall" + have been updated massively. "make install-all" now installs + all three. + * Change default dir for auxiliary files from + /usr/lib/syslinux to /usr/share/syslinux. Changes in 3.64: * SYSLINUX/EXTLINUX: support "localboot" with the same feature diff --git a/com32/lib/MCONFIG b/com32/lib/MCONFIG index 2e36597..b569abf 100644 --- a/com32/lib/MCONFIG +++ b/com32/lib/MCONFIG @@ -1,21 +1,12 @@ # -*- makefile -*- -TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) -CC = gcc - -gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) -c -x c /dev/null -o $$tmpf 2>/dev/null; \ - then echo $(1); else echo $(2); fi; rm -f $$tmpf) +topdir = ../.. +include $(topdir)/MCONFIG GCCOPT := $(call gcc_ok,-m32,) $(call gcc_ok,-fno-stack-protector,) -LD = ld INCLUDE = -I. -AR = ar -RANLIB = ranlib -NM = nm -PERL = perl STRIP = strip --strip-all -R .comment -R .note -OBJCOPY = objcopy # zlib and libpng configuration flags LIBFLAGS = -DDYNAMIC_CRC_TABLE -DPNG_NO_CONSOLE_IO \ diff --git a/com32/lib/Makefile b/com32/lib/Makefile index c2c8036..74f3d7e 100644 --- a/com32/lib/Makefile +++ b/com32/lib/Makefile @@ -96,7 +96,8 @@ LIBOBJS = \ BINDIR = /usr/bin LIBDIR = /usr/lib -AUXDIR = $(LIBDIR)/syslinux +DATADIR = /usr/share +AUXDIR = $(DATADIR)/syslinux INCDIR = /usr/include COM32DIR = $(AUXDIR)/com32 diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile index 4ae9af4..01fefac 100644 --- a/com32/libutil/Makefile +++ b/com32/libutil/Makefile @@ -61,7 +61,8 @@ LNXLIBOBJS = $(patsubst %.o,%.lo,$(LIBOBJS)) BINDIR = /usr/bin LIBDIR = /usr/lib -AUXDIR = $(LIBDIR)/syslinux +DATADIR = /usr/share +AUXDIR = $(DATADIR)/syslinux INCDIR = /usr/include COM32DIR = $(AUXDIR)/com32 diff --git a/com32/menu/Makefile b/com32/menu/Makefile index 17d6f5f..f37e479 100644 --- a/com32/menu/Makefile +++ b/com32/menu/Makefile @@ -47,7 +47,8 @@ LNXLIBS = ../libutil/libutil_lnx.a BINDIR = /usr/bin LIBDIR = /usr/lib -AUXDIR = $(LIBDIR)/syslinux +DATADIR = /usr/share +AUXDIR = $(DATADIR)/syslinux INCDIR = /usr/include COM32DIR = $(AUXDIR)/com32 diff --git a/com32/modules/Makefile b/com32/modules/Makefile index d67f997..dc114f5 100644 --- a/com32/modules/Makefile +++ b/com32/modules/Makefile @@ -47,7 +47,8 @@ LNXLIBS = ../libutil/libutil_lnx.a BINDIR = /usr/bin LIBDIR = /usr/lib -AUXDIR = $(LIBDIR)/syslinux +DATADIR = /usr/share +AUXDIR = $(DATADIR)/syslinux INCDIR = /usr/include COM32DIR = $(AUXDIR)/com32 diff --git a/com32/samples/Makefile b/com32/samples/Makefile index bad0676..6ea3c77 100644 --- a/com32/samples/Makefile +++ b/com32/samples/Makefile @@ -38,7 +38,6 @@ LNXLDFLAGS = -g SFLAGS = -D__COM32__ -march=i386 LDFLAGS = -T ../lib/com32.ld OBJCOPY = objcopy -PPMTOLSS16 = ../ppmtolss16 LIBGCC := $(shell $(CC) --print-libgcc) LIBS = ../libutil/libutil_com.a ../lib/libcom32.a $(LIBGCC) LNXLIBS = ../libutil/libutil_lnx.a diff --git a/syslinux.spec.in b/syslinux.spec.in index 32ab497..f87d6cd 100644 --- a/syslinux.spec.in +++ b/syslinux.spec.in @@ -69,26 +69,14 @@ make CC='%{my_cc}' -C sample tidy %install rm -rf %{buildroot} -mkdir -p %{buildroot}%{_bindir} -mkdir -p %{buildroot}%{_sbindir} -mkdir -p %{buildroot}%{_datadir}/syslinux -mkdir -p %{buildroot}%{_includedir} -mkdir -p %{buildroot}/boot/extlinux %{buildroot}/etc -mkdir -p %{buildroot}/tftpboot/pxelinux.cfg make CC='%{my_cc}' install-all \ INSTALLROOT=%{buildroot} BINDIR=%{_bindir} SBINDIR=%{_sbindir} \ - LIBDIR=%{_datadir} MANDIR=%{_mandir} INCDIR=%{_includedir} + LIBDIR=%{_libdir} DATADIR=%{_datadir} \ + MANDIR=%{_mandir} INCDIR=%{_includedir} \ + TFTPBOOT=/tftpboot EXTLINUXDIR=/boot/extlinux make CC='%{my_cc}' -C sample tidy -cp mkdiskimage syslinux2ansi.pl keytab-lilo.pl %{buildroot}%{_datadir}/syslinux - -cp %{buildroot}%{_datadir}/syslinux/*.c32 %{buildroot}/boot/extlinux -cp %{buildroot}%{_datadir}/syslinux/memdisk %{buildroot}/boot/extlinux ( cd %{buildroot}/etc && ln -s ../boot/extlinux/extlinux.conf . ) -cp %{buildroot}%{_datadir}/syslinux/*.c32 %{buildroot}/tftpboot -cp %{buildroot}%{_datadir}/syslinux/pxelinux.0 %{buildroot}/tftpboot -cp %{buildroot}%{_datadir}/syslinux/memdisk %{buildroot}/tftpboot - %clean rm -rf %{buildroot} @@ -97,20 +85,13 @@ rm -rf %{buildroot} %doc COPYING NEWS doc/* %doc sample %{_mandir}/man*/* -%{_bindir}/syslinux -%{_bindir}/ppmtolss16 -%{_bindir}/lss16toppm -%{_bindir}/gethostip -%{_bindir}/sha1pass -%{_bindir}/md5pass +%{_bindir}/* %{_datadir}/syslinux/*.com %{_datadir}/syslinux/*.exe %{_datadir}/syslinux/*.c32 %{_datadir}/syslinux/*.bin %{_datadir}/syslinux/*.0 %{_datadir}/syslinux/memdisk -%{_datadir}/syslinux/*.pl -%{_datadir}/syslinux/mkdiskimage %files devel %{_datadir}/syslinux/com32 @@ -137,6 +118,9 @@ fi %postun %changelog +* Thu May 29 2008 H. Peter Anvin +- Use install targets; clean up various paths. + * Thu Jan 10 2008 H. Peter Anvin - Add man pages. diff --git a/utils/Makefile b/utils/Makefile index 0c5a363..64f8236 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -13,29 +13,17 @@ # # SYSLINUX utilities # -# No builtin rules -MAKEFLAGS += -r -MAKE += -r -TMPFILE = $(shell mktemp /tmp/gcc_ok.XXXXXX) - -CC = gcc - -gcc_ok = $(shell tmpf=$(TMPFILE); if $(CC) $(1) dummy.c -o $$tmpf 2>/dev/null; \ - then echo '$(1)'; else echo '$(2)'; fi; rm -f $$tmpf) - -comma := , -LDHASH := $(call gcc_ok,-Wl$(comma)--hash-style=both,) +topdir = .. +include $(topdir)/MCONFIG CFLAGS = -W -Wall -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -LDFLAGS = -O2 -s $(LDHASH) -LD = ld -PERL = perl +LDFLAGS = -O2 -s TARGETS = mkdiskimage gethostip ASIS = keytab-lilo lss16toppm md5pass ppmtolss16 sha1pass syslinux2ansi -all: mkdiskimage gethostip +all: $(TARGETS) %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< @@ -56,3 +44,7 @@ clean: tidy spotless: clean installer: all + +install: installer + mkdir -m 755 -p $(INSTALLROOT)$(BINDIR) + install -m 755 $(TARGETS) $(ASIS) $(INSTALLROOT)$(BINDIR) -- 2.7.4