2020-05-19 15:50:47 +03:00
|
|
|
include ../../config.mk
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
TARGET = libidris2_support
|
|
|
|
|
|
|
|
LIBTARGET = $(TARGET).a
|
|
|
|
DYLIBTARGET = $(TARGET)$(SHLIB_SUFFIX)
|
|
|
|
|
2021-07-21 16:35:21 +03:00
|
|
|
SRCS := $(wildcard *.c)
|
|
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
DEPS = $(OBJS:.o=.d)
|
|
|
|
|
2020-05-18 16:51:10 +03:00
|
|
|
CFLAGS += -O2
|
|
|
|
|
2020-05-19 14:11:07 +03:00
|
|
|
ifeq ($(OS), windows)
|
2020-05-20 19:14:38 +03:00
|
|
|
SRCS += windows/win_utils.c windows/win_hack.c
|
2021-07-21 16:35:21 +03:00
|
|
|
CPPFLAGS += -DWIN32_LEAN_AND_MEAN
|
2020-05-23 18:47:10 +03:00
|
|
|
LDFLAGS += -lws2_32
|
2020-06-02 05:30:44 +03:00
|
|
|
ifeq ($(OLD_WIN), 1)
|
2021-07-21 16:35:21 +03:00
|
|
|
CPPFLAGS += -D_OLD_WIN
|
2020-06-02 05:30:44 +03:00
|
|
|
endif
|
2020-05-19 14:11:07 +03:00
|
|
|
endif
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
all: build
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
|
|
|
|
build: $(LIBTARGET) $(DYLIBTARGET)
|
|
|
|
|
|
|
|
$(LIBTARGET): $(OBJS)
|
|
|
|
$(AR) rc $@ $^
|
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
|
|
$(DYLIBTARGET): $(OBJS)
|
2020-05-23 19:05:55 +03:00
|
|
|
$(CC) -shared -o $@ $^ $(LDFLAGS)
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
-include $(DEPS)
|
|
|
|
|
|
|
|
%.d: %.c
|
|
|
|
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2020-05-19 15:50:47 +03:00
|
|
|
$(RM) $(OBJS) $(DYLIBTARGET) $(LIBTARGET)
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
cleandep: clean
|
2020-05-19 15:50:47 +03:00
|
|
|
$(RM) $(DEPS)
|
2020-05-18 16:51:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: install
|
|
|
|
|
|
|
|
install: build
|
2020-09-19 16:09:26 +03:00
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
2021-11-21 00:43:51 +03:00
|
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/c
|
2020-09-19 15:11:12 +03:00
|
|
|
install -m 755 $(DYLIBTARGET) ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
|
|
|
install -m 644 $(LIBTARGET) ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
2021-11-21 00:43:51 +03:00
|
|
|
install -m 644 *.h ${PREFIX}/idris2-${IDRIS2_VERSION}/support/c
|