diff options
| author | 0scar <example@example.org> | 2023-01-09 13:22:29 +0000 |
|---|---|---|
| committer | 0scar <example@example.org> | 2023-01-09 13:22:29 +0000 |
| commit | eb29ccf87462e51b38e4d5ab73bcc54f09ac326c (patch) | |
| tree | 67f3c33178b768cb50243e861afa81cfeda00d2a | |
| parent | 31034fbac86108ef21864ccfc50c2726eef55be8 (diff) | |
Add static and shared library compile targets
| -rw-r--r-- | Makefile | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -2,7 +2,8 @@ CC = gcc LFLAGS = FLAGS = -ansi -Wall -Wextra -pedantic OUT = btree-test -LIB_OUT = libbtree.so +SHARED_OUT = libbtree.so +STATIC_OUT = libbtree.a SRC :=$(wildcard src/*.c) OBJ :=$(addprefix obj/,$(notdir $(SRC:.c=.o))) @@ -19,11 +20,17 @@ debug: obj build build: $(OUT) -lib: DEFS += -fpic -lib: $(LIB_OUT) +static: FLAGS += -fpic +static: $(STATIC_OUT) -$(LIB_OUT): $(OBJ) - $(CC) $(DEFS) $(FLAGS) $(LFLAGS) -shared -o $(LIB_OUT) $(OBJ) +shared: FLAGS += -fpic +shared: $(SHARED_OUT) + +$(SHARED_OUT): $(OBJ) + $(CC) $(DEFS) $(FLAGS) $(LFLAGS) -shared -o $(SHARED_OUT) $(OBJ) + +$(STATIC_OUT): $(OBJ) + ar -rcs -o $(STATIC_OUT) $(OBJ) $(OUT): $(OBJ) $(CC) $(DEFS) $(FLAGS) $(LFLAGS) -o $(OUT) $(OBJ) |
