mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-20 18:21:47 +03:00
9b2811f263
Previously, the RefC files were located in IDRIS2_PREFIX. This is decoupled to allow users to change the prefix (for ad-hoc library install locations, for example).
61 lines
1.1 KiB
Makefile
61 lines
1.1 KiB
Makefile
include ../../config.mk
|
|
|
|
TARGET = libidris2_support
|
|
|
|
LIBTARGET = $(TARGET).a
|
|
DYLIBTARGET = $(TARGET)$(SHLIB_SUFFIX)
|
|
|
|
SRCS := $(wildcard *.c)
|
|
OBJS = $(SRCS:.c=.o)
|
|
DEPS = $(OBJS:.o=.d)
|
|
|
|
CFLAGS += -O2
|
|
|
|
ifeq ($(OS), windows)
|
|
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
|
|
endif
|
|
|
|
|
|
all: build
|
|
|
|
.PHONY: build
|
|
|
|
build: $(LIBTARGET) $(DYLIBTARGET)
|
|
|
|
$(LIBTARGET): $(OBJS)
|
|
$(AR) rc $@ $^
|
|
$(RANLIB) $@
|
|
|
|
$(DYLIBTARGET): $(OBJS)
|
|
$(CC) -shared -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
-include $(DEPS)
|
|
|
|
%.d: %.c
|
|
@$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
$(RM) $(OBJS) $(DYLIBTARGET) $(LIBTARGET)
|
|
|
|
cleandep: clean
|
|
$(RM) $(DEPS)
|
|
|
|
|
|
.PHONY: install
|
|
|
|
install: build
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
|
mkdir -p ${PREFIX}/idris2-${IDRIS2_VERSION}/support/c
|
|
install -m 755 $(DYLIBTARGET) ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
|
install -m 644 $(LIBTARGET) ${PREFIX}/idris2-${IDRIS2_VERSION}/lib
|
|
install -m 644 *.h ${PREFIX}/idris2-${IDRIS2_VERSION}/support/c
|