Idris2/support/c/Makefile

59 lines
1.2 KiB
Makefile
Raw Normal View History

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)
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
CPPFLAGS += -DWIN32_LEAN_AND_MEAN
LDFLAGS += -lws2_32
ifeq ($(OLD_WIN), 1)
CPPFLAGS += -D_OLD_WIN
endif
2020-05-19 14:11:07 +03:00
endif
2020-05-18 16:51:10 +03:00
2022-09-08 02:11:35 +03:00
.PHONY: all
2020-05-18 16:51:10 +03:00
all: build
.PHONY: build
build: $(LIBTARGET) $(DYLIBTARGET)
$(LIBTARGET): $(OBJS)
$(AR) rc $@ $^
$(RANLIB) $@
$(DYLIBTARGET): $(OBJS)
2022-09-08 02:11:35 +03:00
$(CC) $(CFLAGS) $(CPPFLAGS) -shared -o $@ $^ $(LDFLAGS)
2020-05-18 16:51:10 +03:00
-include $(DEPS)
%.d: %.c
2022-09-08 02:11:35 +03:00
@$(CPP) $(CPPFLAGS) $< -MM -MT $(@:.d=.o) >$@
2020-05-18 16:51:10 +03:00
.PHONY: clean
clean:
2020-05-19 15:50:47 +03:00
$(RM) $(OBJS) $(DYLIBTARGET) $(LIBTARGET)
2020-05-18 16:51:10 +03:00
2022-09-08 02:11:35 +03:00
.PHONY: cleandep
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
mkdir -p ${DESTDIR}${PREFIX}/idris2-${IDRIS2_VERSION}/lib
mkdir -p ${DESTDIR}${PREFIX}/idris2-${IDRIS2_VERSION}/support/c
install -m 755 $(DYLIBTARGET) ${DESTDIR}${PREFIX}/idris2-${IDRIS2_VERSION}/lib
install -m 644 $(LIBTARGET) ${DESTDIR}${PREFIX}/idris2-${IDRIS2_VERSION}/lib
install -m 644 *.h ${DESTDIR}${PREFIX}/idris2-${IDRIS2_VERSION}/support/c