aboutsummaryrefslogtreecommitdiffstats
path: root/com32
diff options
context:
space:
mode:
Diffstat (limited to 'com32')
-rw-r--r--com32/Makefile21
-rw-r--r--com32/chain/Makefile4
-rw-r--r--com32/cmenu/Makefile29
-rw-r--r--com32/elflink/ldlinux/Makefile13
-rw-r--r--com32/gfxboot/Makefile7
-rw-r--r--com32/gpllib/Makefile16
-rw-r--r--com32/hdt/Makefile14
-rw-r--r--com32/lib/Makefile16
-rw-r--r--com32/lib/syslinux/version.c2
-rw-r--r--com32/libupload/Makefile10
-rw-r--r--com32/libutil/Makefile3
-rw-r--r--com32/lua/src/Makefile3
-rw-r--r--com32/mboot/Makefile5
-rw-r--r--com32/menu/Makefile15
-rw-r--r--com32/modules/Makefile10
-rw-r--r--com32/rosh/Makefile6
-rw-r--r--com32/rosh/rosh.c2
-rw-r--r--com32/samples/Makefile13
-rw-r--r--com32/sysdump/Makefile11
-rw-r--r--com32/tools/Makefile4
20 files changed, 107 insertions, 97 deletions
diff --git a/com32/Makefile b/com32/Makefile
index c4699cfd..7ea1b01c 100644
--- a/com32/Makefile
+++ b/com32/Makefile
@@ -1,5 +1,22 @@
SUBDIRS = libupload tools lib elflink/ldlinux gpllib libutil modules mboot \
menu samples elflink rosh cmenu hdt gfxboot sysdump lua/src chain
-all tidy dist clean spotless install:
- set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
+.PHONY: subdirs $(SUBDIRS)
+subdirs: $(SUBDIRS)
+$(SUBDIRS):
+ @mkdir -p $(OBJ)/$@
+ $(MAKE) -C $(OBJ)/$@ SRC="$(SRC)"/$@ OBJ="$(OBJ)"/$@/ \
+ -f $(SRC)/$@/Makefile $(MAKECMDGOALS)
+
+all tidy dist clean spotless install: subdirs
+
+# Parallel dependencies
+chain lua/src mboot menu: libutil gpllib
+cmenu: lib libutil
+elflink/ldlinux: lib
+gfxboot: libutil
+hdt: lib libupload cmenu gpllib libutil
+modules: lib libutil gpllib
+rosh: lib libutil
+samples: libutil elflink/ldlinux
+sysdump: libupload gpllib
diff --git a/com32/chain/Makefile b/com32/chain/Makefile
index 9a298fae..32385509 100644
--- a/com32/chain/Makefile
+++ b/com32/chain/Makefile
@@ -11,9 +11,7 @@
##
## -----------------------------------------------------------------------
-
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
OBJS = chain.o partiter.o utility.o options.o mangle.o
diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index beb8dd28..80fff368 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -18,31 +18,34 @@
NOGPL := 1
LIBS = libmenu/libmenu.c32 \
- $(com32)/libutil/libutil_com.c32 \
- $(com32)/lib/libcom32.c32
+ $(objdir)/com32/libutil/libutil_com.c32 \
+ $(objdir)/com32/lib/libcom32.c32
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
-CFLAGS += -I./libmenu
+CFLAGS += -I$(SRC)/libmenu
-LIBMENU = libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
- libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o \
- $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
+LIBMENU = $(objdir)/com32/libutil/libutil_com.c32 \
+ $(objdir)/com32/lib/libcom32.c32 \
+ libmenu/syslnx.o libmenu/com32io.o libmenu/tui.o \
+ libmenu/menu.o libmenu/passwords.o libmenu/des.o libmenu/help.o
-CMENUS = $(patsubst %.c,%.c32,$(wildcard *.c))
-IMENUS = $(patsubst %.menu,%.c32,$(wildcard *.menu))
+CMENUS = $(patsubst %.c,%.c32,$(wildcard $(SRC)/*.c))
+IMENUS = $(patsubst %.menu,%.c32,$(wildcard $(SRC)/*.menu))
-MENUS = $(LIBS) $(CMENUS) $(IMENUS)
+MENUS = $(LIBS) $(subst $(SRC)/,,$(CMENUS) $(IMENUS))
.SUFFIXES: .S .c .o .elf .c32 .menu
.PRECIOUS: %.c
%.c: %.menu adv_menu.tpl
- python menugen.py --input=$< --output=$@ --template=adv_menu.tpl
+ python $(SRC)/menugen.py --input=$< --output=$@ --template=$(SRC)/adv_menu.tpl
-all: menus
+all: makeoutputdirs menus
+
+makeoutputdirs:
+ @mkdir -p $(OBJ)/libmenu
libmenu/libmenu.c32: $(LIBMENU)
$(LD) -shared $(LDFLAGS) -o $@ $^
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
index dc48ca97..58fc9c94 100644
--- a/com32/elflink/ldlinux/Makefile
+++ b/com32/elflink/ldlinux/Makefile
@@ -10,18 +10,19 @@
##
## -----------------------------------------------------------------------
-topdir = ../../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
CFLAGS += -I$(topdir)/core/elflink -I$(topdir)/core/include
-LIBS = --whole-archive $(com32)/lib/libcom32min.a
+LIBS = --whole-archive $(objdir)/com32/lib/libcom32min.a
+
+OBJS = ldlinux.o cli.o readconfig.o refstr.o colors.o getadv.o adv.o \
+ execute.o chainboot.o kernel.o get_key.o advwrite.o setadv.o \
+ eprintf.o loadhigh.o
all: ldlinux.c32 ldlinux_lnx.a
-ldlinux.c32 : ldlinux.o cli.o readconfig.o refstr.o colors.o getadv.o \
- adv.o execute.o chainboot.o kernel.o get_key.o \
- advwrite.o setadv.o eprintf.o loadhigh.o
+ldlinux.c32 : $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^ $(LIBS)
LNXLIBOBJS = get_key.lo
diff --git a/com32/gfxboot/Makefile b/com32/gfxboot/Makefile
index a2420c42..98d6a032 100644
--- a/com32/gfxboot/Makefile
+++ b/com32/gfxboot/Makefile
@@ -11,15 +11,16 @@
##
## -----------------------------------------------------------------------
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
MODULES = gfxboot.c32
all: $(MODULES)
-gfxboot.c32 : gfxboot.o realmode_callback.o $(LIBS) $(C_LIBS)
+OBJS = gfxboot.o realmode_callback.o
+
+gfxboot.c32 : $(OBJS) $(LIBS) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
realmode_callback.o: realmode_callback.asm
diff --git a/com32/gpllib/Makefile b/com32/gpllib/Makefile
index 4f41ca8b..3e2bd03d 100644
--- a/com32/gpllib/Makefile
+++ b/com32/gpllib/Makefile
@@ -3,14 +3,12 @@
#
# Include configuration rules
-topdir = ../..
-MAKEDIR = $(topdir)/mk
include $(MAKEDIR)/lib.mk
-REQFLAGS += -I../gplinclude -I../gplinclude/zzjson
+REQFLAGS += -I$(SRC)/../gplinclude -I$(SRC)/../gplinclude/zzjson
-GPLDIRS := . disk dmi vpd acpi zzjson
-LIBOBJS := $(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+GPLDIRS := $(SRC) $(addprefix $(SRC)/,disk dmi vpd acpi zzjson)
+LIBOBJS := $(subst $(SRC)/,,$(foreach dir,$(GPLDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c))))
BINDIR = /usr/bin
LIBDIR = /usr/lib
@@ -19,7 +17,11 @@ AUXDIR = $(DATADIR)/syslinux
INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
-all: libcom32gpl.c32
+all: makeoutputdirs libcom32gpl.c32
+
+makeoutputdirs:
+ @mkdir -p $(foreach b, \
+ $(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b))
libcom32gpl.c32 : $(LIBOBJS)
$(LD) -shared $(LDFLAGS) -o $@ $^
@@ -38,6 +40,6 @@ install: all
mkdir -m 755 -p $(INSTALLROOT)$(COM32DIR)
install -m 644 libcom32gpl.c32 $(INSTALLROOT)$(COM32DIR)
mkdir -p $(INSTALLROOT)$(COM32DIR)/include/
- cp -r ../gplinclude $(INSTALLROOT)$(COM32DIR)/include/
+ cp -r $(SRC)/../gplinclude $(INSTALLROOT)$(COM32DIR)/include/
-include .*.d */.*.d */*/.*.d
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')
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 705feb3f..eb0d6124 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -4,8 +4,7 @@
# Include configuration rules
NOGPL := 1
-topdir = ../../
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/lib.mk
## OPTIONAL OBJECTS, AVAILABLE AS DYNAMIC LINKED MODULES
@@ -77,8 +76,7 @@ DYNLIBOBJS = \
$(DYNENTRY_OBJS)
-LIBOBJS = \
- $(DYNLIBOBJS)
+LIBOBJS = $(DYNLIBOBJS)
BINDIR = /usr/bin
LIBDIR = /usr/lib
@@ -87,7 +85,11 @@ AUXDIR = $(DATADIR)/syslinux
INCDIR = /usr/include
COM32DIR = $(AUXDIR)/com32
-all: libcom32.c32 libcom32min.a libcom32core.a
+all: makeoutputdirs libcom32.c32 libcom32min.a libcom32core.a
+
+makeoutputdirs:
+ @mkdir -p $(foreach b, \
+ $(addprefix $(OBJ)/,$(sort $(dir $(LIBOBJS) $(MINLIBOBJS) $(CORELIBOBJS)))),$(b))
libcom32.c32 : $(LIBOBJS)
rm -f $@
@@ -114,9 +116,9 @@ spotless: clean
install: all
mkdir -m 755 -p $(INSTALLROOT)$(COM32DIR)
- install -m 644 com32.ld $(INSTALLROOT)$(COM32DIR)
+ install -m 644 $(SRC)/com32.ld $(INSTALLROOT)$(COM32DIR)
-rm -rf $(INSTALLROOT)$(COM32DIR)/include
- cp -r ../include $(INSTALLROOT)$(COM32DIR)
+ cp -r $(SRC)/../include $(INSTALLROOT)$(COM32DIR)
# These files are performance critical, and doesn't compile well with -Os
#FIXME: determine if drawtxt.c is really EFI-dependent
diff --git a/com32/lib/syslinux/version.c b/com32/lib/syslinux/version.c
index 1cd2efd3..6f0554d5 100644
--- a/com32/lib/syslinux/version.c
+++ b/com32/lib/syslinux/version.c
@@ -28,7 +28,7 @@
#include <syslinux/config.h>
#include <klibc/compiler.h>
#include <core.h>
-#include <../../../version.h>
+#include <version.h>
struct syslinux_version __syslinux_version;
diff --git a/com32/libupload/Makefile b/com32/libupload/Makefile
index 83053350..f9440c57 100644
--- a/com32/libupload/Makefile
+++ b/com32/libupload/Makefile
@@ -1,12 +1,10 @@
# Include configuration rules
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/com32.mk
-REQFLAGS += -I./
+REQFLAGS += -I$(SRC)
-SUBDIRS := .
-LIBOBJS := $(foreach dir,$(SUBDIRS),$(patsubst %.c,%.o,$(wildcard $(dir)/*.c)))
+LIBOBJS := $(notdir $(patsubst %.c,%.o,$(wildcard $(SRC)/*.c)))
BINDIR = /usr/bin
LIBDIR = /usr/lib
@@ -34,6 +32,6 @@ install: all
mkdir -m 755 -p $(INSTALLROOT)$(COM32DIR)
install -m 644 libcom32upload.a $(INSTALLROOT)$(COM32DIR)
mkdir -p $(INSTALLROOT)$(COM32DIR)/include/
- cp -r *.h $(INSTALLROOT)$(COM32DIR)/include/
+ cp -r $(SRC)/*.h $(INSTALLROOT)$(COM32DIR)/include/
-include .*.d */.*.d */*/.*.d
diff --git a/com32/libutil/Makefile b/com32/libutil/Makefile
index 93c0c11c..535b4aba 100644
--- a/com32/libutil/Makefile
+++ b/com32/libutil/Makefile
@@ -29,8 +29,7 @@
## Utility companion library for the COM32 library
##
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
LIBOBJS = ansiline.o ansiraw.o keyname.o \
diff --git a/com32/lua/src/Makefile b/com32/lua/src/Makefile
index 01d1f81c..70a7e808 100644
--- a/com32/lua/src/Makefile
+++ b/com32/lua/src/Makefile
@@ -15,8 +15,7 @@
## Lua Makefile
##
-topdir = ../../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
LNXLIBS =
diff --git a/com32/mboot/Makefile b/com32/mboot/Makefile
index 02e9f49e..a3f61ba8 100644
--- a/com32/mboot/Makefile
+++ b/com32/mboot/Makefile
@@ -15,11 +15,10 @@
## Multiboot module
##
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
-LNXLIBS = ../libutil/libutil_lnx.a
+LNXLIBS = $(objdir)/com32/libutil/libutil_lnx.a
MODULES = mboot.c32
TESTFILES =
diff --git a/com32/menu/Makefile b/com32/menu/Makefile
index 2096b4c4..9f7a0e46 100644
--- a/com32/menu/Makefile
+++ b/com32/menu/Makefile
@@ -14,26 +14,19 @@
## Simple menu system
##
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
-LNXLIBS = ../libutil/libutil_lnx.a
+LNXLIBS = $(objdir)/com32/libutil/libutil_lnx.a
MODULES = menu.c32 vesamenu.c32
TESTFILES =
-COMMONOBJS = menumain.o readconfig.o passwd.o drain.o printmsg.o colors.o \
- background.o refstr.o
+COMMONOBJS = menumain.o readconfig.o passwd.o drain.o \
+ printmsg.o colors.o background.o refstr.o
all: $(MODULES) $(TESTFILES)
-menu.c32 : menu.o $(COMMONOBJS) $(C_LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
-
-vesamenu.c32 : vesamenu.o $(COMMONOBJS) $(C_LIBS)
- $(LD) $(LDFLAGS) -o $@ $^
-
vesamenu.c32: vesamenu.o $(COMMONOBJS) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
diff --git a/com32/modules/Makefile b/com32/modules/Makefile
index 8f5b7692..392c720f 100644
--- a/com32/modules/Makefile
+++ b/com32/modules/Makefile
@@ -15,11 +15,11 @@
## COM32 standard modules
##
-LIBS = $(com32)/gpllib/libcom32gpl.c32 $(com32)/lib/libcom32.c32 \
- $(com32)/libutil/libutil_com.c32
+LIBS = $(objdir)/com32/gpllib/libcom32gpl.c32 \
+ $(objdir)/com32/lib/libcom32.c32 \
+ $(objdir)/com32/libutil/libutil_com.c32
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
MODULES = config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \
@@ -37,7 +37,7 @@ all: $(MODULES) $(TESTFILES)
dmitest.o: dmitest.c
$(CC) $(CFLAGS) $(GPLINCLUDE) -c -o $@ $<
-dmitest.c32 : dmi_utils.o dmitest.o $(GPLLIB) $(LIBS) $(C_LIBS)
+dmitest.c32 : dmi_utils.o dmitest.o $(GPLLIB) $(LIBS) $(C_LIBS)
$(LD) $(LDFLAGS) -o $@ $^
tidy dist:
diff --git a/com32/rosh/Makefile b/com32/rosh/Makefile
index 309dde43..a4c0bc28 100644
--- a/com32/rosh/Makefile
+++ b/com32/rosh/Makefile
@@ -16,10 +16,10 @@
## ROSH Read Only Shell
##
-LIBS = $(com32)/libutil/libutil_com.c32 $(com32)/lib/libcom32.c32
+LIBS = $(objdir)/com32/libutil/libutil_com.c32 \
+ $(objdir)/com32/lib/libcom32.c32
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/rosh.mk
# from com32/sysdump/Makefile
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 68dad3f3..8198a2ba 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -37,7 +37,7 @@
* debugging enabled; Comment to remove.
*/
#include "rosh.h"
-#include "../../version.h"
+#include "version.h"
#define APP_LONGNAME "Read-Only Shell"
#define APP_NAME "rosh"
diff --git a/com32/samples/Makefile b/com32/samples/Makefile
index c7abaddb..ca04f644 100644
--- a/com32/samples/Makefile
+++ b/com32/samples/Makefile
@@ -14,17 +14,16 @@
## samples for syslinux users
##
-LIBS = $(com32)/libutil/libutil_com.c32
+LIBS = $(objdir)/com32/libutil/libutil_com.c32
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
all: hello.c32 resolv.c32 serialinfo.c32 \
- localboot.c32 \
- fancyhello.c32 fancyhello.lnx \
- keytest.c32 keytest.lnx \
- advdump.c32 entrydump.c32
+ localboot.c32 \
+ fancyhello.c32 fancyhello.lnx \
+ keytest.c32 keytest.lnx \
+ advdump.c32 entrydump.c32
tidy dist:
rm -f *.o *.lo *.a *.lst *.elf .*.d *.tmp
diff --git a/com32/sysdump/Makefile b/com32/sysdump/Makefile
index 8763b3c8..dca5d717 100644
--- a/com32/sysdump/Makefile
+++ b/com32/sysdump/Makefile
@@ -15,21 +15,20 @@
## Simple menu system
##
-topdir = ../..
-MAKEDIR = $(topdir)/mk
+VPATH = $(SRC)
include $(MAKEDIR)/elf.mk
-include $(topdir)/version.mk
-LIBS = ../libupload/libcom32upload.a
-LNXLIBS = ../libutil/libutil_lnx.a
+LIBS = $(objdir)/com32/libupload/libcom32upload.a
+LNXLIBS = $(objdir)/com32/libutil/libutil_lnx.a
CFLAGS += -I$(com32) -I$(topdir)
MODULES = sysdump.c32
TESTFILES =
-SRCS = $(wildcard *.c)
-OBJS = $(patsubst %.c,%.o,$(SRCS))
+SRCS = $(wildcard $(SRC)/*.c)
+OBJS = $(subst $(SRC)/,,$(patsubst %.c,%.o,$(SRCS)))
# The DATE is set on the make command line when building binaries for
# official release. Otherwise, substitute a hex string that is pretty much
diff --git a/com32/tools/Makefile b/com32/tools/Makefile
index 0161baf1..9c0ea708 100644
--- a/com32/tools/Makefile
+++ b/com32/tools/Makefile
@@ -10,12 +10,12 @@
##
## -----------------------------------------------------------------------
-MAKEDIR = ../../mk
+VPATH = $(SRC)
include $(MAKEDIR)/build.mk
BINS = relocs
-INCLUDES += -I./include
+INCLUDES += -I$(SRC)/include
all : $(BINS)