Skip to content

Commit

Permalink
Os-specific CFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
Florents-Tselai committed Feb 24, 2024
1 parent 027045c commit 145d6ee
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
CC=gcc
SRC=litejq.c
OUT=litejq

PKG_CONFIG ?= pkg-config

CFLAGS=-shared -fPIC
# OS detection
UNAME_S := $(shell uname -s)

# Conditional OS-specific flags
ifeq ($(UNAME_S),Darwin) # macOS
CFLAGS = -Wall -Wsign-compare -fPIC -dynamiclib
OUT = litejq.dylib
else ifeq ($(UNAME_S),Linux)
CFLAGS = -z now -z relro -Wall -Wsign-compare -Wno-unknown-pragmas -fPIC -shared
OUT = litejq.so
endif

SQLITE_FLAGS=$(shell $(PKG_CONFIG) --cflags --libs sqlite3)
CFLAGS += $(SQLITE_FLAGS)
Expand Down

0 comments on commit 145d6ee

Please sign in to comment.