2013-05-15 22:12:05 +00:00
|
|
|
# ======================================================================= #
|
|
|
|
# ACK CONFIGURATION #
|
|
|
|
# (Edit this before building) #
|
|
|
|
# ======================================================================= #
|
|
|
|
|
|
|
|
# What platform to build for by default?
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
DEFAULT_PLATFORM ?= pc86
|
2013-05-15 22:12:05 +00:00
|
|
|
|
|
|
|
# Where should the ACK put its temporary files?
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
ACK_TEMP_DIR ?= /tmp
|
2013-05-15 22:12:05 +00:00
|
|
|
|
2016-03-17 19:52:15 +00:00
|
|
|
# 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).
|
2013-05-15 22:12:05 +00:00
|
|
|
|
2022-07-19 19:21:48 +00:00
|
|
|
ifeq ($(OS),Windows_NT)
|
2022-07-19 22:25:07 +00:00
|
|
|
PREFIX ?= c:/ack
|
2022-07-19 19:21:48 +00:00
|
|
|
else
|
2022-01-27 05:00:04 +00:00
|
|
|
PREFIX ?= /usr/local
|
2018-09-01 13:34:01 +00:00
|
|
|
#PREFIX = $(INSDIR)
|
2022-07-19 19:21:48 +00:00
|
|
|
endif
|
2013-05-15 22:12:05 +00:00
|
|
|
|
|
|
|
# Where do you want to put the object files used when building?
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
BUILDDIR ?= $(ACK_TEMP_DIR)/ack-build
|
2013-05-15 22:12:05 +00:00
|
|
|
|
2018-06-02 19:30:52 +00:00
|
|
|
# What build flags do you want to use for native code?
|
2013-05-15 22:12:05 +00:00
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
CFLAGS ?= -g -Wno-return-type
|
|
|
|
LDFLAGS ?=
|
2013-05-15 22:12:05 +00:00
|
|
|
|
2016-07-16 12:58:29 +00:00
|
|
|
# Various commands.
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
AR ?= ar
|
|
|
|
CC ?= gcc
|
2022-06-26 20:28:30 +00:00
|
|
|
LUA ?= lua
|
2016-07-16 12:58:29 +00:00
|
|
|
|
2016-09-01 21:36:39 +00:00
|
|
|
# Which build system to use; use 'ninja' or 'make' (in lower case). Leave
|
|
|
|
# blank to autodetect.
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
BUILDSYSTEM ?=
|
2016-09-01 21:36:39 +00:00
|
|
|
|
|
|
|
# Build flags for ninja.
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
NINJAFLAGS ?=
|
2016-09-01 21:36:39 +00:00
|
|
|
|
|
|
|
# Build flags for make.
|
|
|
|
|
2022-01-27 05:00:04 +00:00
|
|
|
MAKEFLAGS ?=
|
2016-09-01 21:36:39 +00:00
|
|
|
|
2013-05-15 22:12:05 +00:00
|
|
|
# ======================================================================= #
|
|
|
|
# END OF CONFIGURATION #
|
|
|
|
# ======================================================================= #
|
2016-07-16 12:58:29 +00:00
|
|
|
|
2013-05-15 22:12:05 +00:00
|
|
|
# You shouldn't need to change anything below this point unless you are
|
|
|
|
# actually developing ACK.
|
|
|
|
|
2016-07-18 21:16:27 +00:00
|
|
|
OBJDIR = $(abspath $(BUILDDIR)/obj)
|
|
|
|
BINDIR = $(abspath $(BUILDDIR)/bin)
|
|
|
|
LIBDIR = $(abspath $(BUILDDIR)/lib)
|
|
|
|
INCDIR = $(abspath $(BUILDDIR)/include)
|
|
|
|
INSDIR = $(abspath $(BUILDDIR)/staging)
|
2013-05-12 19:45:55 +00:00
|
|
|
|
|
|
|
PLATIND = $(INSDIR)/share/ack
|
|
|
|
PLATDEP = $(INSDIR)/lib/ack
|
|
|
|
|
2016-10-30 14:49:39 +00:00
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
ifeq ($(BUILDSYSTEM),)
|
|
|
|
ifneq ($(shell which ninja),)
|
2016-09-01 21:36:39 +00:00
|
|
|
BUILDSYSTEM = ninja
|
2017-10-30 21:09:19 +00:00
|
|
|
else
|
2016-09-01 21:36:39 +00:00
|
|
|
BUILDSYSTEM = make
|
2017-10-30 21:09:19 +00:00
|
|
|
endif
|
2016-09-01 21:36:39 +00:00
|
|
|
endif
|
2016-07-16 12:58:29 +00:00
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
build-file = $(BUILDDIR)/build.$(BUILDSYSTEM)
|
2019-02-13 21:42:05 +00:00
|
|
|
lua-files = $(shell find . -name 'build*.lua')
|
2017-10-30 21:09:19 +00:00
|
|
|
our-lua = $(BUILDDIR)/lua
|
|
|
|
|
|
|
|
# GNU make sets MAKECMDGOALS to the list of targets from the command
|
|
|
|
# line. We look for targets with '+' and forward them to BUILDSYSTEM.
|
|
|
|
# This handles commands like
|
|
|
|
# $ make util/opt+pkg util/ego+pkg
|
|
|
|
|
|
|
|
all-goals = +ack +tests
|
|
|
|
plus-goals := $(patsubst all,$(all-goals),$(or $(MAKECMDGOALS),all))
|
|
|
|
plus-goals := $(foreach g,$(plus-goals),$(if $(findstring +,$(g)),$(g),))
|
2016-10-16 18:07:54 +00:00
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
# @true silences extra message, "make: Nothing to be done..."
|
2016-08-14 22:47:08 +00:00
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
all: build-plus-goals
|
|
|
|
@true
|
2016-08-14 22:47:08 +00:00
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
ifneq ($(plus-goals),)
|
|
|
|
$(plus-goals): build-plus-goals
|
|
|
|
@true
|
2016-09-01 21:36:39 +00:00
|
|
|
endif
|
2016-07-16 12:58:29 +00:00
|
|
|
|
2017-10-30 21:09:19 +00:00
|
|
|
build-plus-goals: $(build-file)
|
|
|
|
ifeq ($(BUILDSYSTEM),ninja)
|
|
|
|
@ninja $(NINJAFLAGS) -f $(build-file) $(plus-goals)
|
|
|
|
else ifeq ($(BUILDSYSTEM),make)
|
|
|
|
# GNU make passes MAKEFLAGS in environment.
|
|
|
|
@$(MAKE) -f $(build-file) $(plus-goals)
|
|
|
|
else
|
|
|
|
$(error unknown BUILDSYSTEM = $(BUILDSYSTEM))
|
|
|
|
endif
|
|
|
|
|
2022-07-16 11:13:08 +00:00
|
|
|
$(build-file): first/ackbuilder.lua Makefile $(lua-files)
|
2016-07-16 12:58:29 +00:00
|
|
|
@mkdir -p $(BUILDDIR)
|
2022-06-26 20:28:30 +00:00
|
|
|
@$(LUA) first/ackbuilder.lua \
|
2016-09-01 21:36:39 +00:00
|
|
|
first/build.lua build.lua \
|
|
|
|
--$(BUILDSYSTEM) \
|
2022-06-26 20:28:30 +00:00
|
|
|
LUA=$(LUA) \
|
2016-11-11 22:05:50 +00:00
|
|
|
DEFAULT_PLATFORM=$(DEFAULT_PLATFORM) \
|
2016-08-14 22:47:08 +00:00
|
|
|
OBJDIR=$(OBJDIR) \
|
|
|
|
BINDIR=$(BINDIR) \
|
|
|
|
LIBDIR=$(LIBDIR) \
|
|
|
|
INCDIR=$(INCDIR) \
|
|
|
|
INSDIR=$(INSDIR) \
|
|
|
|
PLATIND=$(PLATIND) \
|
|
|
|
PLATDEP=$(PLATDEP) \
|
2022-07-19 19:21:48 +00:00
|
|
|
PREFIX="$(PREFIX)" \
|
2016-08-14 22:47:08 +00:00
|
|
|
AR=$(AR) \
|
|
|
|
CC=$(CC) \
|
2018-06-02 19:30:52 +00:00
|
|
|
CFLAGS="$(CFLAGS)" \
|
2022-07-19 19:21:48 +00:00
|
|
|
LDFLAGS="$(LDFLAGS)" \
|
2017-10-30 21:09:19 +00:00
|
|
|
> $(build-file)
|
2016-07-16 12:58:29 +00:00
|
|
|
|
2022-07-19 19:21:48 +00:00
|
|
|
ack-setup.exe: etc/windows-installer.nsi
|
|
|
|
makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $<
|
|
|
|
|
2016-09-02 21:03:57 +00:00
|
|
|
install:
|
|
|
|
mkdir -p $(PREFIX)
|
|
|
|
tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
|
|
|
|
|
2013-05-12 19:45:55 +00:00
|
|
|
clean:
|
2017-10-30 21:09:19 +00:00
|
|
|
rm -rf $(BUILDDIR)
|
2016-07-16 12:58:29 +00:00
|
|
|
|