From 1408e6ca7b3854d94aaa39612b4bb6fdf9111dc7 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Tue, 25 Sep 2012 14:45:18 +0100 Subject: Add per-firmware object directory support Now that we have multiple firmware backends it no longer makes sense to write object files to the same directory as their source. A better solution is to write the object files to a per-firmware directory under a top-level object directory. The top-level object directory can be specified on the command-line with the O= variable, e.g. make O=/tmp/obj. If no top-level object directory is specified an 'obj' directory is created in the top-level of the Syslinux source repository. All the existing make targets continue to work as before, however now they apply to all firmware backends, e.g. 'make installer' will build the BIOS, 32-bit EFI and 64-bit EFI installers and place them under $(OBJ)/bios, $(OBJ)/efi32 and $(OBJ)/efi64 respectively. Note unlike every other bit of Syslinux, the gpxe objects are still kept in the src directory, e.g. gpxe/src, since gpxe is only required by the BIOS backend. It is possible to specify a make target for a specific firmware or list of firmware with the following syntax, make [firmware[,firmware]] [target[,target]] To clean the object directory for just the BIOS firmware type, 'make bios clean' To build both the 32-bit and 64-bit EFI installers type, 'make efi32 efi64 installer' Since the Syslinux make infrastructure is now more complex a new file doc/building.txt has been created to explain how to build Syslinux. The top-level Makefile now exports some make variables for use in module Makefiles, - topdir - the top-level source directory of the Syslinux repository, e.g. /usr/src/syslinux - objdir - the top-level object directory for the firmware backend currently being built, e.g. /obj/syslinux/bios - SRC - the source directory in the Syslinux repository for the module currently being built, e.g. /usr/src/syslinux/com32/libupload - OBJ - the object directory for the module currently being built, e.g. /obj/syslinux/bios/com32/libupload Since we're rewriting the Makefile infrastructure anyway it seemed like a good idea to add parallel support. By writing subdirectories as prequisites for make targets the objects in those subdirectories can be built in parallel. Signed-off-by: Matt Fleming --- com32/hdt/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'com32/hdt/Makefile') diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile index ff0fa2e2..386c7472 100644 --- a/com32/hdt/Makefile +++ b/com32/hdt/Makefile @@ -15,20 +15,20 @@ ## Hardware Detection Tool ## -topdir = ../.. -MAKEDIR = $(topdir)/mk +VPATH = $(SRC) include $(MAKEDIR)/elf.mk -LIBS = ../libupload/libcom32upload.a -C_LIBS += $(com32)/cmenu/libmenu/libmenu.c32 \ - $(com32)/libutil/libutil_com.c32 \ - $(com32)/lib/libcom32.c32 $(com32)/gpllib/libcom32gpl.c32 +LIBS = $(objdir)/com32/libupload/libcom32upload.a +C_LIBS += $(objdir)/com32/cmenu/libmenu/libmenu.c32 \ + $(objdir)/com32/libutil/libutil_com.c32 \ + $(objdir)/com32/lib/libcom32.c32 \ + $(objdir)/com32/gpllib/libcom32gpl.c32 CFLAGS += -I$(com32)/cmenu/libmenu -I$(com32) MODULES = hdt.c32 TESTFILES = -OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) +OBJS = $(subst $(SRC)/,,$(patsubst %.c,%.o,$(wildcard $(SRC)/*.c))) VERSION = $(shell $(SED) -n 's/\#define VERSION \"\(.*\)\"/\1/p' hdt.h) CODENAME = $(shell $(SED) -n 's/\#define CODENAME \"\(.*\)\"/\1/p' hdt.h) NODASH_VERSION = $(shell echo $(VERSION) | $(SED) -e 's/-/_/g' | $(SED) -e 's/\./_/g') -- cgit v1.2.1