Skip to content

Commit 65ef3db

Browse files
committed
Handle compiler issues in makefile
1 parent c5f3699 commit 65ef3db

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

Makefile

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,50 @@ GCC_IS_CLANG=$(shell $(CC) --version | grep -i clang >/dev/null && echo yes || e
1818
CLANG_IS_GCC=$(shell $(CC) --version | grep -i GCC >/dev/null && echo yes || echo no)
1919
ifeq ($(CC), gcc)
2020
ifeq ($(GCC_IS_CLANG), yes)
21-
$(info Using clang instead of gcc. gcc is aliased to clang on your system.)
22-
CC = clang
21+
$(info Using clang instead of gcc. gcc is aliased to clang on your system.)
22+
_CC = clang
2323
endif
2424
endif
2525

2626
ifeq ($(CC), clang)
2727
ifeq ($(CLANG_IS_GCC), yes)
28-
$(info Using gcc instead of clang. clang is aliased to gcc on your system.)
29-
CC = clang
28+
$(info Using gcc instead of clang. clang is aliased to gcc on your system.)
29+
_CC = gcc
3030
endif
3131
endif
3232

33-
ifeq ($(CC),gcc)
34-
CFLAGS_RELEASE += -fopenmp -DOMP
35-
CFLAGS_DEBUG += -fopenmp -DOMP
36-
LDFLAGS += -lgomp
33+
ifeq ($(_CC), gcc)
34+
CFLAGS_RELEASE += -fopenmp -DOMP
35+
CFLAGS_DEBUG += -fopenmp -DOMP
36+
LDLIBS += -lgomp
3737
endif
3838

39-
ifeq ($(CC),clang)
40-
LDFLAGS += -lomp
39+
ifeq ($(_CC),clang)
40+
LDLIBS += -lomp
4141
endif
4242

43-
ifeq ($(PLATFORM),Darwin)
44-
SHARED_SUFFIX=dylib
45-
BREW_PATH=$(shell brew --prefix)
46-
INCLUDES += -I $(BREW_PATH)/opt/libomp/include -I $(BREW_PATH)/opt/argp-standalone/include
47-
LDFLAGS += -L $(BREW_PATH)/opt/libomp/lib -L $(BREW_PATH)/opt/argp-standalone/lib
43+
ifeq ($(PLATFORM), Darwin)
44+
SHARED_SUFFIX = dylib
45+
BREW_PATH = $(shell brew --prefix)
46+
INCLUDES += -I $(BREW_PATH)/opt/libomp/include -I $(BREW_PATH)/opt/argp-standalone/include
47+
LDFLAGS += -L $(BREW_PATH)/opt/libomp/lib -L $(BREW_PATH)/opt/argp-standalone/lib
48+
LDLIBS += -largp
4849
endif
4950

50-
ifeq ($(PLATFORM),Linux)
51-
SHARED_SUFFIX=so
52-
ifeq ($(CC),clang)
53-
CFLAGS_RELEASE += -Xclang -fopenmp -DOMP
54-
CFLAGS_DEBUG += -Xclang -fopenmp -DOMP
55-
endif
51+
ifeq ($(PLATFORM), Linux)
52+
SHARED_SUFFIX = so
53+
ifeq ($(_CC), clang)
54+
CFLAGS_RELEASE += -Xclang -fopenmp -DOMP
55+
CFLAGS_DEBUG += -Xclang -fopenmp -DOMP
56+
endif
5657
endif
5758

5859
ifeq ($(BUILD), release)
59-
CFLAGS = $(CFLAGS_RELEASE)
60+
CFLAGS = $(CFLAGS_RELEASE)
6061
else ifeq ($(BUILD), debug)
61-
CFLAGS = $(CFLAGS_DEBUG)
62+
CFLAGS = $(CFLAGS_DEBUG)
6263
else
63-
$(error Invalid BUILD '$(BUILD)', expected 'release' or 'debug')
64+
$(error Invalid BUILD '$(BUILD)', expected 'release' or 'debug')
6465
endif
6566

6667
SHARED_LIB = lib$(LIBRARY_NAME).$(SHARED_SUFFIX)

0 commit comments

Comments
 (0)