util-src/GNUmakefile
author Kim Alvefur <zash@zash.se>
Wed, 27 Mar 2024 19:33:11 +0100
changeset 13471 c2a476f4712a
parent 12697 7c5afbdcbc77
permissions -rw-r--r--
util.startup: Fix exiting on pidfile trouble prosody.shutdown() relies on prosody.main_thread, which has not been set yet at this point. Doing a clean shutdown might actually be harmful in case it tears down things set up by the conflicting Prosody, such as the very pidfile we were looking at. Thanks again SigmaTel71 for noticing


include ../config.unix

CFLAGS+=-I$(LUA_INCDIR)

INSTALL_DATA=install -m644
TARGET?=../util/

ALL=encodings.so hashes.so net.so pposix.so signal.so table.so \
    ringbuffer.so time.so poll.so compat.so strbitop.so \
    struct.so crypto.so

ifdef RANDOM
ALL+=crand.so
endif

.PHONY: all install clean
.SUFFIXES: .c .o .so

all: $(ALL)

install: $(ALL)
	$(INSTALL_DATA) $? $(TARGET)

clean:
	rm -f $(ALL) $(patsubst %.so,%.o,$(ALL))

encodings.o: CFLAGS+=$(IDNA_FLAGS)
encodings.so: LDLIBS+=$(IDNA_LIBS)

crypto.so hashes.so: LDLIBS+=$(OPENSSL_LIBS)

crand.o: CFLAGS+=-DWITH_$(RANDOM)
crand.so: LDLIBS+=$(RANDOM_LIBS)

%.so: %.o
	$(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)