aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 1e80311cfee6ef985f2fbbfcd1b43f8024018626 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
AR      := ar
CC      := gcc
SLIB    := lib/libsalis.a
DLIB    := lib/libsalis.so

SOURCES := $(wildcard src/*.c)
OBJECTS := $(patsubst src/%.c,build/%.o,$(SOURCES))
DEPS    := $(patsubst %.o,%.d,$(OBJECTS))

SLFLAGS := rs
DLFLAGS := -shared

# uncomment for debug
# OFLAGS  := -ggdb

# uncomment for release
OFLAGS  := -O3 -DNDEBUG

CFLAGS  := -Iinclude -c $(OFLAGS) -MMD -Wall -Wextra -std=c89 -pedantic-errors \
           -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition

all: $(OBJECTS)
	$(AR) $(SLFLAGS) $(SLIB) $(OBJECTS)
	$(CC) $(DLFLAGS) -o $(DLIB) $(OBJECTS)
	$(MAKE) -C tsalis

-include $(DEPS)

$(OBJECTS): $(patsubst build/%.o,src/%.c,$@)
	$(CC) $(CFLAGS) $(patsubst build/%.o,src/%.c,$@) -o $@

clean:
	-rm build/*
	-rm $(SLIB)
	-rm $(DLIB)
	$(MAKE) clean -C tsalis