summaryrefslogtreecommitdiff
path: root/core/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'core/Makefile')
-rw-r--r--core/Makefile91
1 files changed, 76 insertions, 15 deletions
diff --git a/core/Makefile b/core/Makefile
index 14590eb6..562e49f5 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -25,7 +25,8 @@ include $(MAKEDIR)/embedded.mk
-include $(objdir)/version.mk
OPTFLAGS =
-INCLUDES = -I$(SRC)/include -I$(com32)/include -I$(com32)/include/sys -I$(com32)/lib
+INCLUDES = -I$(SRC)/include -I$(com32)/include -I$(com32)/include/sys -I$(com32)/lib \
+ -I$(SRC)/lwip/src/include -I$(SRC)/lwip/src/include/ipv4 -I$(SRC)/fs/pxe
# This is very similar to cp437; technically it's for Norway and Denmark,
# but it's unlikely the characters that are different will be used in
@@ -35,27 +36,56 @@ CODEPAGE = cp865
# The targets to build in this directory...
BTARGET = kwdhash.gen \
ldlinux.bss ldlinux.sys ldlinux.bin \
- isolinux.bin isolinux-debug.bin pxelinux.0
+ isolinux.bin isolinux-debug.bin pxelinux.0 lpxelinux.0
# All primary source files for the main syslinux files
NASMSRC := $(wildcard $(SRC)/*.asm)
NASMHDR := $(wildcard $(SRC)/*.inc)
-CSRC := $(wildcard $(SRC)/*.c $(SRC)/*/*.c $(SRC)/*/*/*.c)
-SSRC := $(wildcard $(SRC)/*.S $(SRC)/*/*.S $(SRC)/*/*/*.S)
-CHDR := $(wildcard $(SRC)/*.h $(SRC)/*/*.h $(SRC)/*/*/*.h)
+CSRC := $(shell find $(SRC) -name '*.c' -print)
+SSRC := $(shell find $(SRC) -name '*.S' -print)
+CHDR := $(shell find $(SRC) -name '*.h' -print)
OTHERSRC := keywords
ALLSRC = $(NASMSRC) $(NASMHDR) $(CSRC) $(SSRC) $(CHDR) $(OTHERSRC)
COBJ := $(subst $(SRC)/,,$(patsubst %.c,%.o,$(CSRC)))
SOBJ := $(subst $(SRC)/,,$(patsubst %.S,%.o,$(SSRC)))
-# Don't include derivative-specific objects
-COBJS = $(filter-out %rawcon.o %plaincon.o %pxelinux-c.o %ldlinux-c.o %isolinux-c.o,$(COBJ))
+# To make this compatible with the following $(filter-out), make sure
+# we prefix everything with $(SRC)
+CORE_PXE_CSRC = \
+ $(addprefix $(SRC)/fs/pxe/, dhcp_option.c pxe.c tftp.c urlparse.c)
+
+LPXELINUX_CSRC = $(CORE_PXE_CSRC) \
+ $(shell find $(SRC)/lwip -name '*.c' -print) \
+ $(addprefix $(SRC)/fs/pxe/, \
+ core.c dnsresolv.c ftp.c ftp_readdir.c gpxeurl.c http.c \
+ http_readdir.c idle.c isr.c tcp.c)
+
+PXELINUX_CSRC = $(CORE_PXE_CSRC) \
+ $(shell find $(SRC)/legacynet -name '*.c' -print)
+
+LPXELINUX_OBJS = $(subst $(SRC)/,,$(LPXELINUX_CSRC:%.c=%.o))
+PXELINUX_OBJS = $(subst $(SRC)/,,$(PXELINUX_CSRC:%.c=%.o))
+
+# Don't include console and network stack specific objects
+FILTER_OBJS = %rawcon.o %plaincon.o %pxelinux-c.o %ldlinux-c.o %isolinux-c.o \
+ $(subst $(OBJ)/,,$(LPXELINUX_OBJS)) \
+ $(subst $(OBJ)/,,$(PXELINUX_OBJS))
+
+ifdef EFI_BUILD
+# EFI is single-threaded.
+FILTER_OBJS += $(subst $(SRC)/,, \
+ $(patsubst %.c,%.o, $(wildcard $(SRC)/thread/*.c)) \
+ $(patsubst %.S,%.o, $(wildcard $(SRC)/thread/*.S)))
+endif
+
+COBJS = $(filter-out $(FILTER_OBJS),$(COBJ))
+SOBJS = $(filter-out $(FILTER_OBJS),$(SOBJ))
LIB = libcom32.a
LIBS = $(LIB) --whole-archive $(objdir)/com32/lib/libcom32core.a
LIBDEP = $(filter-out -% %start%,$(LIBS))
-LIBOBJS = $(COBJS) $(SOBJ)
+LIBOBJS = $(COBJS) $(SOBJS)
NASMDEBUG = -g -F dwarf
NASMOPT += $(NASMDEBUG)
@@ -88,7 +118,7 @@ ifeq ($(ARCH),x86_64)
endif
ifdef EFI_BUILD
-all: makeoutputdirs $(filter-out %bios.o,$(COBJS)) codepage.o
+all: makeoutputdirs $(filter-out %bios.o,$(COBJS) $(SOBJS)) codepage.o
else
all: makeoutputdirs $(BTARGET)
endif
@@ -117,7 +147,8 @@ kwdhash.gen: keywords genhash.pl
-I$(SRC)/ \
-l $(@:.o=.lsr) -o $@ -MP -MD $(dir $@).$(notdir $@).d $<
-AUXLIBS = libisolinux.a libisolinux-debug.a libldlinux.a libpxelinux.a
+AUXLIBS = libisolinux.a libisolinux-debug.a libldlinux.a \
+ libpxelinux.a liblpxelinux.a
LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld
%.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS)
@@ -135,11 +166,21 @@ libisolinux.a: rawcon.o isolinux-c.o
libisolinux-debug.a: libisolinux.a
cp $^ $@
-libpxelinux.a: rawcon.o pxelinux-c.o
+# Legacy network stack
+libpxelinux.a: rawcon.o pxelinux-c.o $(PXELINUX_OBJS)
rm -f $@
$(AR) cq $@ $^
$(RANLIB) $@
+# LwIP network stack
+liblpxelinux.a: rawcon.o pxelinux-c.o
+ $(MAKE) OBJ="$(OBJ)" SRC="$(SRC)" -f $(SRC)/Makefile \
+ CFLAGS="$(CFLAGS) -I$(objdir) -DIS_LPXELINUX" $(LPXELINUX_OBJS)
+ rm -f $@
+ $(AR) cq $@ $^ $(LPXELINUX_OBJS)
+ $(RANLIB) $@
+ rm $(LPXELINUX_OBJS)
+
libldlinux.a: plaincon.o ldlinux-c.o
rm -f $@
$(AR) cq $@ $^
@@ -150,9 +191,28 @@ $(LIB): $(LIBOBJS)
$(AR) cq $@ $^
$(RANLIB) $@
+pxelinux.o: pxelinux.asm kwdhash.gen ../version.gen
+ $(NASM) -f $(NASM_ELF) $(NASMOPT) -DDATE_STR="'$(DATE)'" \
+ -DHEXDATE="$(HEXDATE)" \
+ -D$(ARCH) \
+ -I$(SRC)/ \
+ -DIS_LPXELINUX=0 \
+ -l $(@:.o=.lsr) -o $@ -MP -MD $(dir $@).$(notdir $@).d $<
+
pxelinux.0: pxelinux.bin
cp -f $< $@
+lpxelinux.o: pxelinux.asm kwdhash.gen ../version.gen
+ $(NASM) -f $(NASM_ELF) $(NASMOPT) -DDATE_STR="'$(DATE)'" \
+ -DHEXDATE="$(HEXDATE)" \
+ -D$(ARCH) \
+ -I$(SRC)/ \
+ -DIS_LPXELINUX=1 \
+ -l $(@:.o=.lsr) -o $@ -MP -MD $(dir $@).$(notdir $@).d $<
+
+lpxelinux.0: lpxelinux.bin
+ cp -f $< $@
+
ldlinux.bss: ldlinux.bin
dd if=$< of=$@ bs=512 count=1
@@ -173,10 +233,11 @@ install-all: install install-lib
netinstall: installer
tidy dist:
- rm -f codepage.cp *.o *.elf *.a stupid.* patch.offset .depend .*.d
+ find . -type f \( -name '*.o' -o -name '*.a' -o -name '.*.d' \
+ -o -name '*.lst' \) -print | xargs -rt rm -f
+ rm -f codepage.cp *.elf stupid.* patch.offset .depend
rm -f *.elf.tmp *.sym
- rm -f *.lsr *.lst *.map *.sec *.raw
- rm -f */*.o */*/*.o */*.lst */*/*.lst */.*.d */*/.*.d
+ rm -f *.lsr *.map *.sec *.raw
rm -f $(OBSOLETE) $(LIB)
clean: tidy
@@ -185,4 +246,4 @@ spotless: clean
rm -f $(BTARGET) *.bin *_bin.c
# Include dependencies file
--include .*.d */.*.d */*/.*.d
+-include $(shell find . -name '.*.d' -print)