Skip to content

Commit d2b25d7

Browse files
authored
Fix make finding lib directories with M1 homebrew (#90)
1 parent 5fdedd5 commit d2b25d7

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

Makefile

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,38 @@ else
4242
VER := $(shell git describe --tags --always --dirty)
4343
endif
4444

45-
# Preprocessor Flags
45+
# Set Flags
4646
ALL_CPPFLAGS := $(CPPFLAGS) -DVERSION='"$(VER)"'
47+
ALL_LDFLAGS := $(LDFLAGS) -L/usr/lib
48+
ALL_LDLIBS := -lc -lm -lcurl -lzip
4749
ALL_CPPFLAGS += -D_GNU_SOURCE
4850
ALL_CPPFLAGS += $(shell pkg-config --cflags libzip)
51+
4952
ALL_CPPFLAGS += -I/usr/include
5053
ALL_CPPFLAGS += -I/usr/local/include
51-
ALL_CPPFLAGS += -I/usr/local/opt/curl/include
52-
ALL_CPPFLAGS += -I/usr/local/opt/libzip/include
53-
54-
# Linker Flags
55-
ALL_LDFLAGS := $(LDFLAGS) -L/usr/lib
5654
ALL_LDFLAGS += -L/usr/local/lib
57-
ALL_LDFLAGS += -L/usr/local/opt/curl/lib
58-
ALL_LDFLAGS += -L/usr/local/opt/libzip/lib
59-
ALL_LDLIBS := -lc -lm -lcurl -lzip
55+
ifneq (,$(wildcard /opt/homebrew/.*))
56+
ALL_CCPFLAGS += -I/opt/homebrew/include
57+
ALL_CPPFLAGS += -I/opt/homebrew/lib
58+
endif
59+
60+
ifneq (,$(wildcard /usr/local/opt/curl/.*))
61+
ALL_CPPFLAGS += -I/usr/local/opt/curl/include
62+
ALL_LDFLAGS += -L/usr/local/opt/curl/lib
63+
endif
64+
ifneq (,$(wildcard /opt/homebrew/opt/curl/.))
65+
ALL_CPPFLAGS += -I/opt/homebrew/opt/curl/include
66+
ALL_LDFLAGS += -L/opt/homebrew/opt/curl/lib
67+
endif
6068

69+
ifneq (,$(wildcard /usr/local/opt/libzip/.))
70+
ALL_CPPFLAGS += -I/usr/local/opt/libzip/include
71+
ALL_LDFLAGS += -L/usr/local/opt/libzip/lib
72+
endif
73+
ifneq (,$(wildcard /opt/homebrew/opt/libzip/.))
74+
ALL_CPPFLAGS += -I/opt/homebrew/opt/libzip/include
75+
ALL_LDFLAGS += -L/opt/homebrew/opt/libzip/lib
76+
endif
6177

6278
# Source, Binaries, Dependencies
6379
SRC := $(shell find $(SRCDIR) -type f -name '*.c')

0 commit comments

Comments
 (0)