Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated makefile to allow for creating static libraries #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ GRAVITY_SRC = src/cli/gravity.c
EXAMPLE_SRC = examples/example.c

CC ?= gcc
AR ?= ar
RANLIB ?= ranlib
SRC = $(wildcard $(COMPILER_DIR)*.c) \
$(wildcard $(RUNTIME_DIR)*.c) \
$(wildcard $(SHARED_DIR)*.c) \
Expand All @@ -17,6 +19,8 @@ INCLUDE = -I$(COMPILER_DIR) -I$(RUNTIME_DIR) -I$(SHARED_DIR) -I$(UTILS_DIR) -I$(
CFLAGS = $(INCLUDE) -std=gnu99 -fgnu89-inline -fPIC -DBUILD_GRAVITY_API
OBJ = $(SRC:.c=.o)

SLIBTARGET=libgravity.a

ifeq ($(OS),Windows_NT)
# Windows
LIBTARGET = gravity.dll
Expand Down Expand Up @@ -67,7 +71,12 @@ example: $(OBJ) $(EXAMPLE_SRC)
lib: gravity
$(CC) -shared -o $(LIBTARGET) $(OBJ) $(LDFLAGS)

staticlib: gravity
$(AR) crs $(SLIBTARGET) $(OBJ)
$(RANLIB) $(SLIBTARGET)
# $(CC) -shared -o $(LIBTARGET) $(OBJ) $(LDFLAGS)

clean:
rm -f $(OBJ) gravity example libgravity.so gravity.dll
rm -f $(OBJ) gravity example $(LIBTARGET) $(SLIBTARGET) gravity.dll

.PHONY: all clean gravity example