Skip to content

Commit 4a6895c

Browse files
authored
Merge pull request #325 from davidgiven/dtrg-ab
Replace the build system to use ab.
2 parents d73e696 + a3589cf commit 4a6895c

File tree

553 files changed

+8269
-10204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

553 files changed

+8269
-10204
lines changed

.github/workflows/ccpp.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ on: [push, pull_request]
88

99
jobs:
1010
build-linux:
11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v3
1414
- name: apt
15-
run: sudo apt update && sudo apt install bison flex ninja-build lua5.3
15+
run: sudo apt update && sudo apt install bison flex lua5.3
1616
- name: make
1717
run: make
1818

@@ -21,10 +21,10 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323
- name: brew
24-
run: brew install ninja [email protected]
24+
run: brew install python [email protected] coreutils make
2525
- name: make
2626
run: |
27-
make
27+
gmake
2828
2929
build-windows:
3030
runs-on: windows-latest
@@ -41,15 +41,16 @@ jobs:
4141
mingw-w64-ucrt-x86_64-gcc
4242
mingw-w64-ucrt-x86_64-lua
4343
mingw-w64-ucrt-x86_64-nsis
44-
ninja
44+
mingw-w64-ucrt-x86_64-pkg-config
45+
mingw-w64-ucrt-x86_64-python
4546
bison
4647
flex
4748
zip
4849
git
4950
- uses: actions/checkout@v3
5051
- name: build
5152
run: |
52-
make LDFLAGS="-s -static" CFLAGS="-g -Os"
53+
make LDFLAGS="-s -static"
5354
- name: package
5455
run: |
5556
make ack-setup.exe

Makefile

Lines changed: 24 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
DEFAULT_PLATFORM ?= pc86
99

10+
# Which architectures should get built?
11+
12+
$(if $(PLATS), $(error Don't set PLATS on the command line, because reasons. Edit the Makefile instead.))
13+
PLATS = all
14+
# PLATS = linux386 linuxppc linuxmips
15+
1016
# Where should the ACK put its temporary files?
1117

1218
ifeq ($(TMPDIR),)
@@ -15,142 +21,48 @@ else
1521
ACK_TEMP_DIR ?= $(TMPDIR)
1622
endif
1723

24+
INSDIR = $(OBJ)/staging
25+
1826
# Where is the ACK going to be installed, eventually? If you don't want to
1927
# install it and just want to run the ACK from the build directory
2028
# ($(TMPDIR)/ack-build/staging, by default), leave this as $(INSDIR).
2129

2230
ifeq ($(OS),Windows_NT)
2331
PREFIX ?= c:/ack
2432
else
25-
PREFIX ?= /usr/local
33+
PREFIX ?= /opt/pkg/ack
2634
#PREFIX = $(INSDIR)
2735
endif
2836

29-
# Where do you want to put the object files used when building?
30-
31-
BUILDDIR ?= $(ACK_TEMP_DIR)/ack-build
32-
3337
# What build flags do you want to use for native code?
3438

35-
CFLAGS ?= -g \
39+
CFLAGS ?= -g -Os \
3640
-Werror=return-type \
3741
-Werror=implicit-function-declaration \
38-
-Werror=strict-prototypes
42+
-Werror=strict-prototypes \
43+
-DUNREACHABLE_CODE='__builtin_unreachable()' \
44+
-DNORETURN=_Noreturn
45+
46+
HOSTCFLAGS = $(CFLAGS)
47+
ACKCFLAGS = -O
3948

4049
LDFLAGS ?= -g
4150

4251
# Various commands.
4352

44-
AR ?= ar
45-
CC ?= gcc
4653
LUA ?= lua
4754

48-
# Which build system to use; use 'ninja' or 'make' (in lower case). Leave
49-
# blank to autodetect.
50-
51-
BUILDSYSTEM ?=
55+
.PHONY: all
56+
all: +all
5257

53-
# Build flags for ninja.
58+
# Custom rule to build the installer.
5459

55-
NINJAFLAGS ?=
56-
57-
# Build flags for make.
58-
59-
MAKEFLAGS ?=
60-
61-
# ======================================================================= #
62-
# END OF CONFIGURATION #
63-
# ======================================================================= #
64-
65-
# You shouldn't need to change anything below this point unless you are
66-
# actually developing ACK.
67-
68-
OBJDIR = $(abspath $(BUILDDIR)/obj)
69-
BINDIR = $(abspath $(BUILDDIR)/bin)
70-
LIBDIR = $(abspath $(BUILDDIR)/lib)
71-
INCDIR = $(abspath $(BUILDDIR)/include)
72-
INSDIR = $(abspath $(BUILDDIR)/staging)
60+
ack-setup.exe: etc/windows-installer.nsi all
61+
makensis -dBUILDDIR="$$(realpath $(INSDIR))" -dOUTFILE="$$(realpath $@)" $<
7362

7463
PLATIND = $(INSDIR)/share/ack
7564
PLATDEP = $(INSDIR)/lib/ack
65+
export PLATS
7666

77-
MANDATORYCFLAGS = \
78-
-DUNREACHABLE_CODE='__builtin_unreachable()' \
79-
-DNORETURN=_Noreturn
80-
81-
MANDATORYLDFLAGS =
82-
83-
.NOTPARALLEL:
84-
85-
ifeq ($(BUILDSYSTEM),)
86-
ifneq ($(shell which ninja),)
87-
BUILDSYSTEM = ninja
88-
else
89-
BUILDSYSTEM = make
90-
endif
91-
endif
92-
93-
build-file = $(BUILDDIR)/build.$(BUILDSYSTEM)
94-
lua-files = $(shell find . -name 'build*.lua')
95-
our-lua = $(BUILDDIR)/lua
96-
97-
# GNU make sets MAKECMDGOALS to the list of targets from the command
98-
# line. We look for targets with '+' and forward them to BUILDSYSTEM.
99-
# This handles commands like
100-
# $ make util/opt+pkg util/ego+pkg
101-
102-
all-goals = +ack +tests
103-
plus-goals := $(patsubst all,$(all-goals),$(or $(MAKECMDGOALS),all))
104-
plus-goals := $(foreach g,$(plus-goals),$(if $(findstring +,$(g)),$(g),))
105-
106-
# @true silences extra message, "make: Nothing to be done..."
107-
108-
all: build-plus-goals
109-
@true
110-
111-
ifneq ($(plus-goals),)
112-
$(plus-goals): build-plus-goals
113-
@true
114-
endif
115-
116-
build-plus-goals: $(build-file)
117-
ifeq ($(BUILDSYSTEM),ninja)
118-
@ninja $(NINJAFLAGS) -f $(build-file) $(plus-goals)
119-
else ifeq ($(BUILDSYSTEM),make)
120-
# GNU make passes MAKEFLAGS in environment.
121-
@$(MAKE) -f $(build-file) $(plus-goals)
122-
else
123-
$(error unknown BUILDSYSTEM = $(BUILDSYSTEM))
124-
endif
125-
126-
$(build-file): first/ackbuilder.lua Makefile $(lua-files)
127-
@mkdir -p $(BUILDDIR)
128-
@$(LUA) first/ackbuilder.lua \
129-
first/build.lua build.lua \
130-
--$(BUILDSYSTEM) \
131-
LUA=$(LUA) \
132-
DEFAULT_PLATFORM=$(DEFAULT_PLATFORM) \
133-
OBJDIR=$(OBJDIR) \
134-
BINDIR=$(BINDIR) \
135-
LIBDIR=$(LIBDIR) \
136-
INCDIR=$(INCDIR) \
137-
INSDIR=$(INSDIR) \
138-
PLATIND=$(PLATIND) \
139-
PLATDEP=$(PLATDEP) \
140-
PREFIX="$(PREFIX)" \
141-
AR=$(AR) \
142-
CC=$(CC) \
143-
CFLAGS="$(MANDATORYCFLAGS) $(CFLAGS)" \
144-
LDFLAGS="$(MANDATORYLDFLAGS) $(LDFLAGS)" \
145-
> $(build-file)
146-
147-
ack-setup.exe: etc/windows-installer.nsi
148-
makensis -dBUILDDIR=$(BUILDDIR)/staging -dOUTFILE="$$(realpath $@)" $<
149-
150-
install:
151-
mkdir -p $(PREFIX)
152-
tar cf - -C $(INSDIR) . | tar xvf - -C $(PREFIX)
153-
154-
clean:
155-
rm -rf $(BUILDDIR)
156-
67+
AB_ENABLE_PROGRESS_INFO = false
68+
include build/ab.mk

README

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
THE AMSTERDAM COMPILER KIT V6.1pre1
2-
===================================
1+
THE AMSTERDAM COMPILER KIT V6.2+
2+
================================
33

44
© 1987-2005 Vrije Universiteit, Amsterdam
5-
2022-08-19
5+
2025-04-17
66

77

88
INTRODUCTION
@@ -13,42 +13,40 @@ front end compilers for a number of different languages, code generators,
1313
support libraries, and all the tools necessary to go from source code to
1414
executable on any of the platforms it supports.
1515

16-
This is an early prerelease of the apocryphal version 6.1 release. Not a
17-
lot is supported, the build mechanism needs work, and a lot of things are
18-
probably broken. However, what's there should be sufficient to get things
19-
done and to evaluate how the full 6.1 release should work.
20-
2116

2217

2318
SUPPORT
2419
=======
2520

2621
Languages:
2722

28-
ANSI C, B, Pascal, Modula 2, Basic. K&R is supported via the ANSI C compiler.
23+
ANSI C, Pascal, Modula 2, Basic. K&R is supported via the ANSI C compiler.
2924

3025
Platforms:
3126

32-
pc86 produces bootable floppy disk images for 8086 PCs
27+
cpm produces i80 CP/M .COM files
28+
em22 produces EM22 bytecode files
3329
linux386 produces ELF executables for PC Linux systems
3430
linux68k produces ELF executables for m68020 Linux systems
35-
linuxppc produces ELF executables for PowerPC Linux systems
3631
linuxmips produces ELF executables for little-endian MIPS32r2 Linux systems
32+
linuxppc produces ELF executables for PowerPC Linux systems
3733
minix68k produces Minix executables for m68000 Minix systems
38-
cpm produces i80 CP/M .COM files
39-
rpi produces Raspberry Pi GPU binaries
40-
pdpv7 produces PDP/11 V7 Unix binaries
41-
msdos86 produces i86 MS-DOS .COM files
4234
msdos386 produces i386 MS-DOS 32-bit DPMI .EXE files
35+
msdos86 produces i86 MS-DOS .COM files
36+
osx386 produces i386 OSX MachO executables
37+
osxppc produces PowerPC OSX MachO executables
38+
pc86 produces bootable floppy disk images for 8086 PCs
39+
pdpv7 produces PDP/11 V7 Unix binaries
40+
rpi produces Raspberry Pi GPU binaries
4341

4442

4543

4644
INSTALLATION
4745
============
4846

49-
The version 5.0 build mechanism has been completely rewritten. Installation
50-
ought to be fairly straightforward. It will build on Unixishes including Linux,
51-
OSX, and Windows using MSYS2 and mingw32.
47+
The version 5.0 build mechanism has been completely rewritten (twice).
48+
Installation ought to be fairly straightforward. It will build on Unixishes
49+
including Linux, OSX, and Windows using MSYS2 and mingw32.
5250

5351
Requirements:
5452

@@ -61,32 +59,25 @@ Requirements:
6159

6260
- Lua (any version) with the lua-posix library installed.
6361

64-
- (optionally) ninja; if you've got this, this will be autodetected and give
65-
you faster builds.
66-
67-
- about 115MB free in /tmp (or some other temporary directory).
62+
- Python 3.4 or above.
6863

69-
- about 15MB in the target directory.
64+
- about 1GB in the target directory.
7065

7166
Instructions:
7267

7368
- edit the Makefile. There's a small section at the top where you can change
7469
the configuration. Probably the only one you may want to edit is PREFIX,
75-
which changes where the ACK installs to.
70+
which changes where the ACK installs to, and PLATS, which changes which
71+
architectures are built. Look in `plat/*` to see what plats there are.
7672

7773
- Run:
7874

7975
make
8076

8177
...from the command line. This will do the build.
8278

83-
The make system is fully parallelisable. If you have a multicore system,
84-
install ninja and it'll use all your cores. If you don't have ninja, you
85-
can still use make for parallel builds with:
86-
87-
make -r -j8 # or however many cores you have
88-
89-
...but frankly, I recommend ninja.
79+
The make system is fully parallelisable by default, but does take a while
80+
to start up.
9081

9182
- Run:
9283

@@ -192,4 +183,4 @@ Please enjoy.
192183

193184
David Given (davidgiven on Github)
194185
195-
2018-09-18
186+
2025-04-17

0 commit comments

Comments
 (0)