zeroconf/Makefile
2020-10-16 15:32:18 +01:00

69 lines
1.4 KiB
Makefile

#
# Makefile for tinysvcmdns
#
MV ?= mv
CPPFLAGS += -DPTHREAD_CREATE_DETACHED_SUPPORTED
#CPPFLAGS += -DNDEBUG
CPPFLAGS += $(CPPFLAGS_EXTRA)
CFLAGS += -Wall -pedantic -std=gnu99
CFLAGS += -g
CFLAGS += -O2
CFLAGS += $(CFLAGS_EXTRA)
LDLIBS = -lpthread
ifneq ($(CROSS_COMPILE),)
CC = gcc
CC := $(CROSS_COMPILE)$(CC)
AR := $(CROSS_COMPILE)$(AR)
endif
BIN=testmdnsd mdnsd
LIBTINYSVCMDNS_OBJS = mdns.o mdnsd.o
.PHONY: all clean opkg release opkg-service opkg-init
all: $(BIN) libtinysvcmdns.a
clean:
-$(RM) $(LIBTINYSVCMDNS_OBJS)
-$(RM) $(BIN)
-$(RM) libtinysvcmdns.a
mdns.o: mdns.h
mdnsd.o: mdns.h mdnsd.h
testmdnsd.o: mdnsd.h
testmdnsd: testmdnsd.o libtinysvcmdns.a
libtinysvcmdns.a: $(patsubst %, libtinysvcmdns.a(%), $(LIBTINYSVCMDNS_OBJS))
mdnsd: testmdnsd
strip -o $@ $<
opkg-init: $(wildcard etc/init.d/*)
install -d opkg/etc/init.d
install -p $? opkg/etc/init.d/
opkg-service: $(wildcard etc/modservice.d/*)
install -d opkg/etc/modservice.d
install -m 644 -p $? opkg/etc/modservice.d/
opkg: mdnsd $(wildcard opkg/CONTROL/*) opkg-init opkg-service
install -d opkg/sbin
install -p $< opkg/sbin/
$(foreach opk,$(wildcard *.opk),$(MV) $(opk) $(opk).old; )
opkg-pack opkg
release: opkg
tagname=$$(echo zeroconf*.opk | sed -n 'p;q') && \
tagname="$${tagname%_*.*}" && \
test -n "$${tagname}" && \
git tag -f -a -m "Release $${tagname}" "$${tagname}"