Skip to content

Commit feb03c5

Browse files
br3akzerojohn-tornblom
authored andcommitted
feat: add Makefile.macos for macOS builds
Uses Homebrew's curl include/lib paths via brew --prefix, supporting both Apple Silicon and Intel Macs.
1 parent ee7dbed commit feb03c5

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Makefile.macos

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (C) 2024 John Törnblom
2+
#
3+
# This file is free software; you can redistribute it and/or modify it
4+
# under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; either version 3 of the License, or
6+
# (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful, but
9+
# WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11+
# General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program; see the file COPYING. If not see
15+
# <http://www.gnu.org/licenses/>.
16+
17+
BREW_PREFIX := $(shell brew --prefix)
18+
CURL_PREFIX := $(BREW_PREFIX)/opt/curl
19+
20+
CFLAGS := -O2 -Wall -Werror -I$(CURL_PREFIX)/include
21+
LDFLAGS := -L$(CURL_PREFIX)/lib
22+
LDADD := -lcurl
23+
24+
ELF := fetchpkg
25+
all: $(ELF)
26+
27+
$(ELF): main.c dl.c parson.c sha256.c sha1.c
28+
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDADD)
29+
30+
clean:
31+
rm -f $(ELF)

0 commit comments

Comments
 (0)