SRC_PATH=$(word 1, $(dir $(MAKEFILE_LIST)))
vpath %.c $(SRC_PATH)

CC = $(CROSS)gcc
AR = $(CROSS)ar

CFLAGS = -O2 -Wall -Wundef -I$(SRC_PATH) -D_FORTIFY_SOURCE=0 -D__SSP_FORTIFY_LEVEL=0

SOURCES = $(filter-out ssp-local.c, $(patsubst $(SRC_PATH)%,%,$(wildcard $(SRC_PATH)*.c)))
OBJS = $(SOURCES:%.c=%.o)

all: libssp.a libssp_nonshared.a libssp-0.dll

libssp.a: $(OBJS)
	$(AR) rcs $@ $+

libssp-0.dll: $(OBJS)
	$(CC) -shared -o $@ $+ -Wl,--out-implib,libssp.dll.a

libssp_nonshared.a: ssp-local.o
	$(AR) rcs $@ $+

clean:
	rm -f *.a *.o *.dll
