srcdir= @srcdir@
top_srcdir= @top_srcdir@
top_builddir= @top_builddir@
include $(top_srcdir)/Mk/l4.base.mk
CFLAGS+= -fno-builtin
KICKSTART_LINKBASE?= 00800000
PROGRAM= kickstart
PROGRAM_DEPS= $(top_builddir)/lib/io/libio.a $(srcdir)/Makefile.in \
$(PROGRAM_DEPS_$(ARCH))
LIBS+= $(LIBS_$(ARCH))
SRCS= crt0-$(ARCH).S kickstart.cc kipmgr.cc elf.cc lib.cc \
$(ARCH).cc $(SRCS_$(ARCH))
OBJS+= $(OBJS_$(ARCH))
SRCS_MBI= mbi.cc mbi-$(ARCH).cc mbi-loader.cc
IO32FILES= $(IO32FILES_$(ARCH))
GENFILES= $(GENFILES_$(ARCH))
LDFLAGS+= -Ttext=$(KICKSTART_LINKBASE) \
-L$(srcdir) -Tkickstart.ld
CFLAGS+= -DREVISION="`cat .revision`"
LGCC=
SRCS_ia32= $(SRCS_MBI)
LIBS_ia32= -lio
SRCS_amd64= $(SRCS_MBI)
OBJS_amd64+= elf64.o
GENFILES_amd64= elf64.cc
LIBS_amd64= -lio32
CFLAGS_amd64= -m32 -O2
CPPFLAGS_amd64= -I$(top_srcdir)/lib/io -I$(srcdir) -DALSO_ELF64
LDFLAGS_amd64= -b elf32-i386 --oformat elf32-i386 \
-N -m elf_i386 -L.
IO32FILES_amd64= get_hex.cc print.cc $(ARCH)-getc.cc $(ARCH)-putc.cc
PROGRAM_DEPS_amd64= $(top_builddir)/util/kickstart/libio32.a
pre-all: .revision copy_io32files $(GENFILES)
post-clean:
rm -f .revision $(GENFILES)
rm -f $(IO32FILES:.cc=32.o) $(IO32FILES:.cc=32.cc) libio32.a
.revision: $(SRCS)
@$(ECHO_MSG) Making `echo $(srcdir)/ | sed s,^$(top_srcdir)/*,,`$@
@(cd $(srcdir) ; grep "\$$[I][d]:" $(SRCS)) | \
$(AWK) '{sum += $$5} END {print sum}' > $@
copy_io32files:
@for F in $(IO32FILES:.cc=); do \
test $${F}32.cc -nt $(top_srcdir)/lib/io/$${F}.cc || \
cp $(top_srcdir)/lib/io/$${F}.cc $${F}32.cc; \
done
libio32.a: $(IO32FILES:.cc=32.o)
@$(ECHO_MSG) Linking `echo $(srcdir)/$@ | sed s,^$(top_srcdir)/,,`
$(AR) cru $@ $(IO32FILES:.cc=32.o)
$(RANLIB) $@
elf64.cc: $(srcdir)/elf.cc
sed 's:^//\(#define ELF_64on32\):\1:' $(srcdir)/elf.cc > $@
elf32.cc: $(srcdir)/elf.cc
sed 's:^//\(#define ELF_32on64\):\1:' $(srcdir)/elf.cc > $@
include $(top_srcdir)/Mk/l4.prog.mk