Built a make bootstrap that runs either make or ninja depending on which is
installed.
This commit is contained in:
parent
bcf3408e36
commit
523374c36b
3 changed files with 158 additions and 95 deletions
246
Makefile
246
Makefile
|
@ -27,10 +27,15 @@ BUILDDIR = $(ACK_TEMP_DIR)/ack-build
|
||||||
CFLAGS = -g
|
CFLAGS = -g
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
|
# Various commands.
|
||||||
|
|
||||||
|
AR = ar
|
||||||
|
CC = gcc
|
||||||
|
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
# END OF CONFIGURATION #
|
# END OF CONFIGURATION #
|
||||||
# ======================================================================= #
|
# ======================================================================= #
|
||||||
#
|
|
||||||
# You shouldn't need to change anything below this point unless you are
|
# You shouldn't need to change anything below this point unless you are
|
||||||
# actually developing ACK.
|
# actually developing ACK.
|
||||||
|
|
||||||
|
@ -43,107 +48,160 @@ INSDIR = $(BUILDDIR)/staging
|
||||||
PLATIND = $(INSDIR)/share/ack
|
PLATIND = $(INSDIR)/share/ack
|
||||||
PLATDEP = $(INSDIR)/lib/ack
|
PLATDEP = $(INSDIR)/lib/ack
|
||||||
|
|
||||||
CC = gcc
|
MAKECMDGOALS ?= +ack
|
||||||
AR = ar
|
BUILD_FILES = $(shell find * -name build.lua)
|
||||||
RM = rm -f
|
|
||||||
CP = cp
|
|
||||||
|
|
||||||
hide = @
|
NINJA := $(shell which ninja)
|
||||||
|
ifneq ($(findstring +, $(MAKECMDGOALS)),)
|
||||||
|
ifneq ($(NINJA),)
|
||||||
|
|
||||||
CFLAGS += \
|
$(MAKECMDGOALS): $(BUILDDIR)/build.ninja $(BUILDDIR)/rules.ninja
|
||||||
-I$(INCDIR) \
|
@ninja -f $(BUILDDIR)/build.ninja $(MAKECMDGOALS)
|
||||||
-Imodules/h \
|
|
||||||
-Ih
|
|
||||||
|
|
||||||
LDFLAGS +=
|
$(BUILDDIR)/build.ninja: Makefile
|
||||||
|
@mkdir -p $(BUILDDIR)
|
||||||
|
echo "OBJDIR = $(OBJDIR)" > $@
|
||||||
|
echo "BINDIR = $(BINDIR)" >> $@
|
||||||
|
echo "LIBDIR = $(LIBDIR)" >> $@
|
||||||
|
echo "INCDIR = $(INCDIR)" >> $@
|
||||||
|
echo "INSDIR = $(INSDIR)" >> $@
|
||||||
|
echo "PLATIND = $(PLATIND)" >> $@
|
||||||
|
echo "PLATDEP = $(PLATDEP)" >> $@
|
||||||
|
echo "AR = $(AR)" >> $@
|
||||||
|
echo "CC = $(CC)" >> $@
|
||||||
|
echo "subninja $(BUILDDIR)/rules.ninja" >> $@
|
||||||
|
|
||||||
ACKFLAGS = -Ih
|
else
|
||||||
|
|
||||||
all: installables
|
$(MAKECMDGOALS): $(BUILDDIR)/rules.mk
|
||||||
|
make -r -f $(BUILDDIR)/rules.mk $@ \
|
||||||
|
$(MAKEFLAGS) \
|
||||||
|
OBJDIR=$(OBJDIR) \
|
||||||
|
BINDIR=$(BINDIR) \
|
||||||
|
LIBDIR=$(LIBDIR) \
|
||||||
|
INCDIR=$(INCDIR) \
|
||||||
|
INSDIR=$(INSDIR) \
|
||||||
|
PLATIND=$(PLATIND) \
|
||||||
|
PLATDEP=$(PLATDEP) \
|
||||||
|
AR=$(AR) \
|
||||||
|
CC=$(CC)
|
||||||
|
|
||||||
.DELETE_ON_ERROR:
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
include first/core.mk
|
$(BUILDDIR)/rules.ninja: first/ackbuilder.lua $(BUILD_FILES)
|
||||||
|
@mkdir -p $(BUILDDIR)
|
||||||
|
lua5.2 first/ackbuilder.lua first/build.lua build.lua --ninja > $(BUILDDIR)/rules.ninja
|
||||||
|
|
||||||
include modules/src/object/build.mk
|
$(BUILDDIR)/rules.mk: first/ackbuilder.lua $(BUILD_FILES)
|
||||||
include modules/src/alloc/build.mk
|
@mkdir -p $(BUILDDIR)
|
||||||
include modules/src/input/build.mk
|
lua5.2 first/ackbuilder.lua first/build.lua build.lua --make > $(BUILDDIR)/rules.mk
|
||||||
include modules/src/idf/build.mk
|
|
||||||
include modules/src/system/build.mk
|
|
||||||
include modules/src/string/build.mk
|
|
||||||
include modules/src/print/build.mk
|
|
||||||
include modules/src/flt_arith/build.mk
|
|
||||||
include modules/src/em_code/build.mk
|
|
||||||
include modules/src/em_mes/build.mk
|
|
||||||
include modules/src/read_em/build.mk
|
|
||||||
|
|
||||||
include util/amisc/build.mk
|
|
||||||
include util/cmisc/build.mk
|
|
||||||
include util/ack/build.mk
|
|
||||||
include util/LLgen/build.mk
|
|
||||||
include util/data/build.mk
|
|
||||||
include util/opt/build.mk
|
|
||||||
include util/ncgg/build.mk
|
|
||||||
include util/arch/build.mk
|
|
||||||
include util/misc/build.mk
|
|
||||||
include util/led/build.mk
|
|
||||||
include util/topgen/build.mk
|
|
||||||
include util/ego/build.mk
|
|
||||||
|
|
||||||
include lang/cem/build.mk
|
|
||||||
include lang/basic/build.mk
|
|
||||||
include lang/pc/build.mk
|
|
||||||
include lang/m2/build.mk
|
|
||||||
|
|
||||||
include mach/proto/as/build.mk
|
|
||||||
include mach/proto/ncg/build.mk
|
|
||||||
include mach/proto/top/build.mk
|
|
||||||
|
|
||||||
include plat/linux/liblinux/build.mk
|
|
||||||
|
|
||||||
include mach/i80/build.mk
|
|
||||||
include mach/i386/build.mk
|
|
||||||
include mach/i86/build.mk
|
|
||||||
include mach/m68020/build.mk
|
|
||||||
# include mach/powerpc/build.mk
|
|
||||||
include mach/vc4/build.mk
|
|
||||||
|
|
||||||
include plat/build.mk
|
|
||||||
include plat/pc86/build.mk
|
|
||||||
include plat/cpm/build.mk
|
|
||||||
include plat/linux386/build.mk
|
|
||||||
include plat/linux68k/build.mk
|
|
||||||
# include plat/linuxppc/build.mk
|
|
||||||
include plat/rpi/build.mk
|
|
||||||
|
|
||||||
.PHONY: installables
|
|
||||||
installables: $(INSTALLABLES)
|
|
||||||
@echo ""
|
|
||||||
@echo "Build completed successfully."
|
|
||||||
|
|
||||||
.PHONY: install
|
|
||||||
install: installables
|
|
||||||
@echo INSTALLING into $(PREFIX)
|
|
||||||
$(hide) tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
clean:
|
||||||
@echo CLEAN
|
@rm -rf $(BUILDDIR)
|
||||||
$(hide) $(RM) $(CLEANABLES)
|
|
||||||
|
|
||||||
$(INCDIR)/local.h:
|
#
|
||||||
@echo LOCAL
|
#CC = gcc
|
||||||
@mkdir -p $(dir $@)
|
#AR = ar
|
||||||
$(hide) echo '#define VERSION 3' > $@
|
#RM = rm -f
|
||||||
$(hide) echo '#define ACKM "$(DEFAULT_PLATFORM)"' >> $@
|
#CP = cp
|
||||||
$(hide) echo '#define BIGMACHINE 1' >> $@
|
#
|
||||||
$(hide) echo '#define SYS_5' >> $@
|
#hide = @
|
||||||
|
#
|
||||||
$(INCDIR)/em_path.h:
|
#CFLAGS += \
|
||||||
@echo EM_PATH
|
# -I$(INCDIR) \
|
||||||
@mkdir -p $(dir $@)
|
# -Imodules/h \
|
||||||
$(hide) echo '#define TMP_DIR "$(ACK_TEMP_DIR)"' > $@
|
# -Ih
|
||||||
$(hide) echo '#define EM_DIR "$(PREFIX)"' >> $@
|
#
|
||||||
$(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
|
#LDFLAGS +=
|
||||||
|
#
|
||||||
-include $(DEPENDS)
|
#ACKFLAGS = -Ih
|
||||||
|
#
|
||||||
|
#all: installables
|
||||||
|
#
|
||||||
|
#.DELETE_ON_ERROR:
|
||||||
|
#
|
||||||
|
#include first/core.mk
|
||||||
|
#
|
||||||
|
#include modules/src/object/build.mk
|
||||||
|
#include modules/src/alloc/build.mk
|
||||||
|
#include modules/src/input/build.mk
|
||||||
|
#include modules/src/idf/build.mk
|
||||||
|
#include modules/src/system/build.mk
|
||||||
|
#include modules/src/string/build.mk
|
||||||
|
#include modules/src/print/build.mk
|
||||||
|
#include modules/src/flt_arith/build.mk
|
||||||
|
#include modules/src/em_code/build.mk
|
||||||
|
#include modules/src/em_mes/build.mk
|
||||||
|
#include modules/src/read_em/build.mk
|
||||||
|
#
|
||||||
|
#include util/amisc/build.mk
|
||||||
|
#include util/cmisc/build.mk
|
||||||
|
#include util/ack/build.mk
|
||||||
|
#include util/LLgen/build.mk
|
||||||
|
#include util/data/build.mk
|
||||||
|
#include util/opt/build.mk
|
||||||
|
#include util/ncgg/build.mk
|
||||||
|
#include util/arch/build.mk
|
||||||
|
#include util/misc/build.mk
|
||||||
|
#include util/led/build.mk
|
||||||
|
#include util/topgen/build.mk
|
||||||
|
#include util/ego/build.mk
|
||||||
|
#
|
||||||
|
#include lang/cem/build.mk
|
||||||
|
#include lang/basic/build.mk
|
||||||
|
#include lang/pc/build.mk
|
||||||
|
#include lang/m2/build.mk
|
||||||
|
#
|
||||||
|
#include mach/proto/as/build.mk
|
||||||
|
#include mach/proto/ncg/build.mk
|
||||||
|
#include mach/proto/top/build.mk
|
||||||
|
#
|
||||||
|
#include plat/linux/liblinux/build.mk
|
||||||
|
#
|
||||||
|
#include mach/i80/build.mk
|
||||||
|
#include mach/i386/build.mk
|
||||||
|
#include mach/i86/build.mk
|
||||||
|
#include mach/m68020/build.mk
|
||||||
|
## include mach/powerpc/build.mk
|
||||||
|
#include mach/vc4/build.mk
|
||||||
|
#
|
||||||
|
#include plat/build.mk
|
||||||
|
#include plat/pc86/build.mk
|
||||||
|
#include plat/cpm/build.mk
|
||||||
|
#include plat/linux386/build.mk
|
||||||
|
#include plat/linux68k/build.mk
|
||||||
|
## include plat/linuxppc/build.mk
|
||||||
|
#include plat/rpi/build.mk
|
||||||
|
#
|
||||||
|
#.PHONY: installables
|
||||||
|
#installables: $(INSTALLABLES)
|
||||||
|
# @echo ""
|
||||||
|
# @echo "Build completed successfully."
|
||||||
|
#
|
||||||
|
#.PHONY: install
|
||||||
|
#install: installables
|
||||||
|
# @echo INSTALLING into $(PREFIX)
|
||||||
|
# $(hide) tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
|
||||||
|
#
|
||||||
|
#.PHONY: clean
|
||||||
|
#clean:
|
||||||
|
# @echo CLEAN
|
||||||
|
# $(hide) $(RM) $(CLEANABLES)
|
||||||
|
#
|
||||||
|
#$(INCDIR)/local.h:
|
||||||
|
# @echo LOCAL
|
||||||
|
# @mkdir -p $(dir $@)
|
||||||
|
# $(hide) echo '#define VERSION 3' > $@
|
||||||
|
# $(hide) echo '#define ACKM "$(DEFAULT_PLATFORM)"' >> $@
|
||||||
|
# $(hide) echo '#define BIGMACHINE 1' >> $@
|
||||||
|
# $(hide) echo '#define SYS_5' >> $@
|
||||||
|
#
|
||||||
|
#$(INCDIR)/em_path.h:
|
||||||
|
# @echo EM_PATH
|
||||||
|
# @mkdir -p $(dir $@)
|
||||||
|
# $(hide) echo '#define TMP_DIR "$(ACK_TEMP_DIR)"' > $@
|
||||||
|
# $(hide) echo '#define EM_DIR "$(PREFIX)"' >> $@
|
||||||
|
# $(hide) echo '#define ACK_PATH "share/ack/descr"' >> $@
|
||||||
|
#
|
||||||
|
#-include $(DEPENDS)
|
||||||
|
|
|
@ -146,7 +146,10 @@ end
|
||||||
local function abspath(collection)
|
local function abspath(collection)
|
||||||
return dotocollection(collection,
|
return dotocollection(collection,
|
||||||
function(filename)
|
function(filename)
|
||||||
return concatpath(posix.getcwd(), filename)
|
if not filename:find("^[/$]") then
|
||||||
|
filename = concatpath(posix.getcwd(), filename)
|
||||||
|
end
|
||||||
|
return filename
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
2
first/build.ninja
Normal file
2
first/build.ninja
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
subninja .obj/rules.ninja
|
||||||
|
|
Loading…
Add table
Reference in a new issue