diff options
| author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 01:50:44 +0100 | 
|---|---|---|
| committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 01:50:44 +0100 | 
| commit | d7a72d72abf7831fc4b4885be71f340314e45388 (patch) | |
| tree | 2abf683bcd6dddf5fdd701f8688aa72528719202 | |
| parent | 07cb990645680f95c63526390c24c843cf7e9463 (diff) | |
Makefile now compiles both static and dynamic libraries.
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 12 | 
2 files changed, 9 insertions, 4 deletions
| @@ -4,6 +4,7 @@  !Makefile
  !*/Makefile
  *.a
 +*.so
  *.d
  *.o
  *.sim
 @@ -1,12 +1,14 @@  AR      := ar
  CC      := gcc
 -LIB     := lib/libsalis.a
 +SLIB    := lib/libsalis.a
 +DLIB    := lib/libsalis.so
  SOURCES := $(wildcard src/*.c)
  OBJECTS := $(patsubst src/%.c,build/%.o,$(SOURCES))
  DEPS    := $(patsubst %.o,%.d,$(OBJECTS))
 -LFLAGS  := rs
 +SLFLAGS := rs
 +DLFLAGS := -shared
  # uncomment for debug
  # OFLAGS  := -ggdb
 @@ -18,7 +20,8 @@ CFLAGS  := -Iinclude -c $(OFLAGS) -MMD -Wall -Wextra -std=c89 -pedantic-errors \             -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
  all: $(OBJECTS)
 -	$(AR) $(LFLAGS) $(LIB) $(OBJECTS)
 +	$(AR) $(SLFLAGS) $(SLIB) $(OBJECTS)
 +	$(CC) $(DLFLAGS) -o $(DLIB) $(OBJECTS)
  	$(MAKE) -C tsalis
  -include $(DEPS)
 @@ -28,5 +31,6 @@ $(OBJECTS): $(patsubst build/%.o,src/%.c,$@)  clean:
  	-rm build/*
 -	-rm $(LIB)
 +	-rm $(SLIB)
 +	-rm $(DLIB)
  	$(MAKE) clean -C tsalis
 | 
