Skip to content

Commit 674f9b2

Browse files
sertonixesawady
authored andcommitted
replace ./configure with config.mk
Signed-off-by: Sertonix <[email protected]>
1 parent d793f05 commit 674f9b2

23 files changed

+692
-669
lines changed

.builds/alpine.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,13 @@ tasks:
1818
cd qbe
1919
make -j2 PREFIX=/usr
2020
sudo make install PREFIX=/usr
21-
- prepare: |
22-
mkdir harec/build
23-
cd harec/build
24-
../configure
2521
- build: |
26-
cd harec/build
22+
cd harec
23+
cp configs/linux.mk config.mk
2724
make -j2
2825
sudo make install
2926
- tests: |
30-
cd harec/build
27+
cd harec
3128
make check
3229
- stdlib-tests: |
3330
cd hare

.builds/freebsd.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ tasks:
99
cd qbe
1010
make CC=cc PREFIX=/usr
1111
sudo make install PREFIX=/usr
12-
- prepare: |
13-
mkdir harec/build
14-
cd harec/build
15-
../configure
1612
- build: |
17-
cd harec/build
13+
cd harec
14+
cp configs/freebsd.mk config.mk
1815
make -j2
1916
- tests: |
20-
cd harec/build
17+
cd harec
2118
make check

.builds/netbsd.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ tasks:
99
cd qbe
1010
make PREFIX=/usr
1111
sudo make install PREFIX=/usr
12-
- prepare: |
13-
mkdir harec/build
14-
cd harec/build
15-
../configure
1612
- build: |
17-
cd harec/build
13+
cd harec
14+
cp configs/netbsd.mk config.mk
1815
make -j2
1916
- tests: |
20-
cd harec/build
17+
cd harec
2118
make check

.gitignore

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
build
2-
.build/
3-
mod/
4-
harec*
5-
**/*.o
6-
**/*.a
1+
.bin/
2+
.cache/
3+
src/*.o
74
tests/*
85
!tests/*.ha
6+
!tests/*.c
97
!tests/run
10-
!Makefile
11-
!configure
8+
config.mk

Makefile

+59-23
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,72 @@
11
.POSIX:
2-
.SUFFIXES:
3-
OUTDIR=.build
4-
include $(OUTDIR)/config.mk
52

6-
harec: $(harec_objects)
7-
@printf 'CCLD\t$@\n'
8-
@$(CC) $(LDFLAGS) -o $@ $(harec_objects) $(LIBS)
3+
all:
4+
5+
include config.mk
6+
include makefiles/$(PLATFORM).mk
7+
include makefiles/tests.mk
8+
9+
all: $(BINOUT)/harec
10+
11+
C_DEFINES = \
12+
-DVERSION='"'"$(VERSION)"'"' \
13+
-DDEFAULT_TARGET='"$(DEFAULT_TARGET)"'
914

10-
hare_env=
15+
harec_objects = \
16+
src/check.o \
17+
src/emit.o \
18+
src/eval.o \
19+
src/gen.o \
20+
src/genutil.o \
21+
src/identifier.o \
22+
src/lex.o \
23+
src/main.o \
24+
src/mod.o \
25+
src/parse.o \
26+
src/qbe.o \
27+
src/qinstr.o \
28+
src/qtype.o \
29+
src/scope.o \
30+
src/type_store.o \
31+
src/typedef.o \
32+
src/types.o \
33+
src/utf8.o \
34+
src/util.o
1135

12-
include rt/Makefile
13-
include testmod/Makefile
14-
include tests/Makefile
36+
$(BINOUT)/harec: $(harec_objects)
37+
@mkdir -p -- $(BINOUT)
38+
@printf 'CCLD\t%s\n' '$@'
39+
@$(CC) $(LDFLAGS) -o $@ $(harec_objects) $(LIBS)
1540

16-
.SUFFIXES: .c .o .ha .s .scd .1 .5
41+
.SUFFIXES:
42+
.SUFFIXES: .ha .ssa .td .c .o .s .scd .1 .5
1743

1844
.c.o:
19-
@printf 'CC\t$@\n'
20-
@$(CC) -c $(CFLAGS) -o $@ $<
45+
@printf 'CC\t%s\n' '$@'
46+
@$(CC) -c $(CFLAGS) $(C_DEFINES) -o $@ $<
2147

2248
.s.o:
23-
@printf 'AS\t$@\n'
24-
@$(AS) -o $@ $<
49+
@printf 'AS\t%s\n' '$@'
50+
@$(AS) $(ASFLAGS) -o $@ $<
51+
52+
.ssa.s:
53+
@printf 'QBE\t%s\n' '$@'
54+
@$(QBE) $(QBEFLAGS) -o $@ $<
55+
56+
.ssa.td:
57+
@cmp -s $@ $@.tmp 2>/dev/null || cp $@.tmp $@
58+
59+
.ha.ssa:
60+
@printf 'HAREC\t%s\n' '$@'
61+
@$(TDENV) $(BINOUT)/harec $(HARECFLAGS) -o $@ $<
2562

26-
clean: clean-tests clean-rt clean-testmod
27-
@rm -f harec $(harec_objects)
63+
clean:
64+
@rm -rf -- $(HARECACHE) $(BINOUT) $(harec_objects) $(tests)
2865

29-
distclean: clean
30-
@rm -rf "$(OUTDIR)"
66+
check: $(BINOUT)/harec $(tests)
67+
@./tests/run
3168

32-
install: harec
33-
mkdir -p $(DESTDIR)$(BINDIR)
34-
install -m755 harec $(DESTDIR)$(BINDIR)/harec
69+
install: $(BINOUT)/harec
70+
install -Dm755 $(BINOUT)/harec $(DESTDIR)$(BINDIR)/harec
3571

36-
.PHONY: clean distclean install
72+
.PHONY: clean check install

README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ POSIX-compatible systems.
1414
## Building
1515

1616
```
17-
mkdir build
18-
cd build
19-
../configure
17+
cp configs/$platform.mk config.mk
2018
make
2119
```
2220

0 commit comments

Comments
 (0)