Skip to content

Commit c0bb1b7

Browse files
committed
Use llvm clang tools on macOS and explicitly install it on Linux
1 parent 7b02b99 commit c0bb1b7

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions/checkout@v4
1212

1313
- name: Install dependencies
14-
run: sudo apt-get install check
14+
run: sudo apt-get install check clang-19
1515

1616
- name: make
1717
run: make
@@ -44,10 +44,10 @@ jobs:
4444
- uses: actions/checkout@v4
4545

4646
- name: Install clang-tidy
47-
run: sudo apt-get install -y clang-tidy
47+
run: sudo apt-get install -y clang-tidy-19
4848

4949
- name: clang-tidy version
50-
run: clang-tidy --version
50+
run: clang-tidy-19 --version
5151

5252
- name: Tidy
5353
run: bin/tidy

Brewfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
brew "check"
2-
brew "clang-format"
3-
brew "llvm" # for clang and clang-tidy
2+
brew "llvm@19" # for clang, clang-format and clang-tidy

Makefile

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,38 @@ flags = -g -Wall -fPIC
2727
ifeq ($(os),Linux)
2828
test_cflags = $(flags) -I/usr/include/check
2929
test_ldflags = -L/usr/lib/x86_64-linux-gnu -lcheck -lm -lsubunit
30-
llvm_path = TODO
31-
cc = clang
30+
cc = clang-19
3231
clang_format = clang-format-19
33-
clang_tidy = clang-tidy
32+
clang_tidy = clang-tidy-19
3433
endif
3534

3635
ifeq ($(os),Darwin)
3736
brew_prefix := $(shell brew --prefix check)
3837
test_cflags = $(flags) -I$(brew_prefix)/include
3938
test_ldflags = -L$(brew_prefix)/lib -lcheck -lm
40-
llvm_path = /opt/homebrew/opt/llvm
39+
llvm_path = $(shell brew --prefix llvm@19)
4140
cc = $(llvm_path)/bin/clang
42-
clang_format = clang-format
41+
clang_format = $(llvm_path)/bin/clang-format
4342
clang_tidy = $(llvm_path)/bin/clang-tidy
4443
endif
4544

4645
all: $(exec) $(lib_name) test
4746

4847
$(exec): $(objects)
49-
gcc $(objects) $(flags) -o $(exec)
48+
$(cc) $(objects) $(flags) -o $(exec)
5049

5150
$(lib_name): $(objects)
52-
gcc -shared $(objects) $(flags) -o $(lib_name)
51+
$(cc) -shared $(objects) $(flags) -o $(lib_name)
5352
# cp $(lib_name) $(ruby_extension)
5453

5554
%.o: %.c include/%.h
56-
gcc -c $(flags) $< -o $@
55+
$(cc) -c $(flags) $< -o $@
5756

5857
test/%.o: test/%.c
59-
gcc -c $(test_cflags) $< -o $@
58+
$(cc) -c $(test_cflags) $< -o $@
6059

6160
test: $(test_objects) $(non_main_objects)
62-
gcc $(test_objects) $(non_main_objects) $(test_cflags) $(test_ldflags) -o $(test_exec)
61+
$(cc) $(test_objects) $(non_main_objects) $(test_cflags) $(test_ldflags) -o $(test_exec)
6362

6463
clean:
6564
rm -f $(exec) $(test_exec) $(lib_name) $(ruby_extension)

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,25 @@ Seamless Parsing for HTML, ERB, and more.
66

77
This project builds the ERBX program and its associated unit tests using a Makefile for automation. The Makefile provides several useful commands for compiling, running tests, and cleaning the project.
88

9-
### Requirements
9+
### Building
1010

11-
- **GCC**
12-
- **Check**: The project uses the [Check](https://libcheck.github.io/check/) library for unit testing.
13-
- **Clang Format**: The project uses [Clang Format](https://clang.llvm.org/docs/ClangFormat.html) for formatting.
14-
- **Clang Tidy**: The project uses [Clang Format](https://clang.llvm.org/docs/ClangFormat.html) for formatting.
11+
#### Requirements
1512

16-
For Linux:
13+
- [**Check**](https://libcheck.github.io/check/): For unit testing.
14+
- [**Clang 19**](https://clang.llvm.org): The compiler used to build this project.
15+
- [**Clang Format 19**](https://clang.llvm.org/docs/ClangFormat.html): For formatting the project.
16+
- [**Clang Tidy 19**](https://clang.llvm.org/extra/clang-tidy/): For linting the project.
17+
18+
**For Linux:**
1719
```bash
18-
sudo apt-get install check clang-format-19 clang-tidy
20+
sudo apt-get install check clang-19 clang-tidy-19 clang-format-19
1921
```
2022

21-
For macOS (using Homebrew):
23+
**For macOS (using Homebrew):**
2224
```bash
23-
brew install check clang-format llvm
24-
# or
2525
brew bundle
26+
# or
27+
brew install check llvm@19
2628
```
2729

2830
### Commands

0 commit comments

Comments
 (0)