ack/Makefile

114 lines
2.6 KiB
Makefile
Raw Normal View History

# ======================================================================= #
# ACK CONFIGURATION #
# (Edit this before building) #
# ======================================================================= #
# What platform to build for by default?
DEFAULT_PLATFORM = pc86
# Where should the ACK put its temporary files?
ACK_TEMP_DIR = /tmp
# Where is the ACK going to be installed, eventually? If you don't want to
# install it and just want to run the ACK from the build directory
# (/tmp/ack-build/staging, by default), leave this as $(INSDIR).
#PREFIX = /usr/local
PREFIX = $(INSDIR)
# Where do you want to put the object files used when building?
BUILDDIR = $(ACK_TEMP_DIR)/ack-build
# What build flags do you want to use?
CFLAGS = -g
LDFLAGS =
# Various commands.
AR = ar
CC = gcc
2016-09-01 21:36:39 +00:00
# Which build system to use; use 'ninja' or 'make' (in lower case). Leave
# blank to autodetect.
BUILDSYSTEM =
# Build flags for ninja.
NINJAFLAGS =
# Build flags for make.
2016-10-30 13:28:08 +00:00
MAKEFLAGS =
2016-09-01 21:36:39 +00:00
# ======================================================================= #
# END OF CONFIGURATION #
# ======================================================================= #
# You shouldn't need to change anything below this point unless you are
# actually developing ACK.
OBJDIR = $(abspath $(BUILDDIR)/obj)
BINDIR = $(abspath $(BUILDDIR)/bin)
LIBDIR = $(abspath $(BUILDDIR)/lib)
INCDIR = $(abspath $(BUILDDIR)/include)
INSDIR = $(abspath $(BUILDDIR)/staging)
PLATIND = $(INSDIR)/share/ack
PLATDEP = $(INSDIR)/lib/ack
.NOTPARALLEL:
MAKECMDGOALS ?= +ack
BUILD_FILES = $(shell find * -name '*.lua')
2016-09-01 21:36:39 +00:00
ifneq ($(shell which ninja),)
BUILDSYSTEM = ninja
BUILDFLAGS = $(NINJAFLAGS)
else
2016-09-01 21:36:39 +00:00
BUILDSYSTEM = make
BUILDFLAGS = $(MAKEFLAGS)
endif
LUA = $(BUILDDIR)/lua
2016-09-01 21:36:39 +00:00
ifneq ($(findstring +, $(MAKECMDGOALS)),)
2016-09-01 21:36:39 +00:00
$(MAKECMDGOALS): $(BUILDDIR)/build.$(BUILDSYSTEM)
@$(BUILDSYSTEM) $(BUILDFLAGS) -f $^ $(MAKECMDGOALS)
2016-09-01 21:36:39 +00:00
endif
$(BUILDDIR)/build.$(BUILDSYSTEM): first/ackbuilder.lua Makefile $(BUILD_FILES) $(LUA)
@mkdir -p $(BUILDDIR)
@$(LUA) first/ackbuilder.lua \
2016-09-01 21:36:39 +00:00
first/build.lua build.lua \
--$(BUILDSYSTEM) \
OBJDIR=$(OBJDIR) \
BINDIR=$(BINDIR) \
LIBDIR=$(LIBDIR) \
INCDIR=$(INCDIR) \
INSDIR=$(INSDIR) \
PLATIND=$(PLATIND) \
PLATDEP=$(PLATDEP) \
AR=$(AR) \
CC=$(CC) \
2016-09-01 21:36:39 +00:00
> $(BUILDDIR)/build.$(BUILDSYSTEM)
2016-09-02 21:03:57 +00:00
install:
mkdir -p $(PREFIX)
tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
clean:
@rm -rf $(BUILDDIR)
$(LUA): first/lua-5.1/*.c first/lua-5.1/*.h
@echo Bootstrapping build
@mkdir -p $(BUILDDIR)
@$(CC) -o $(LUA) -O first/lua-5.1/*.c -lm