Skip to content

Commit

Permalink
Add install/uninstall and a dist target for releases
Browse files Browse the repository at this point in the history
Signed-off-by: Joachim Wiberg <[email protected]>
troglobit committed Aug 20, 2021
1 parent b50d28c commit 8532dab
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
include build.mk
VERSION = 1.0
NAME = accept-guard
PKG = $(NAME)-$(VERSION)
ARCHIVE = $(PKG).tar.gz

libdir = $(prefix)/lib
docdir = $(prefix)/share/doc/$(NAME)

RM = rm -f
INSTALL = install

CFLAGS += -fPIC
OBJS = accept-guard.o
LIBS = -ldl
LIBNAME = accept-guard.so
DOCFILES = README.md LICENSE

all: $(LIBNAME)

$(LIBNAME): $(OBJS)
@printf " LIB $@\n"
@$(CC) $(CFLAGS) -shared $(OBJS) -o $@ $(LIBS)

install: $(LIBNAME)
@printf " INSTALL $(LIBNAME) to $(DESTDIR)\n"
@$(INSTALL) -d $(DESTDIR)$(libdir)
@$(INSTALL) -d $(DESTDIR)$(docdir)
@$(INSTALL) -m 0644 $(LIBNAME) $(DESTDIR)$(libdir)/$(LIBNAME)
@for file in $(DOCFILES); do \
$(INSTALL) -m 0644 $$file $(DESTDIR)$(docdir)/$$file; \
done

uninstall:
@printf " UNINST $(LIBNAME) from $(DESTDIR)\n"
-@$(RM) $(DESTDIR)$(libdir)/$(LIBNAME)
-@$(RM) -r $(DESTDIR)$(docdir)

clean:
@$(RM) $(LIBNAME) *.o

dist:
@git archive --format=tar.gz --prefix=$(PKG)/ -o ../$(ARCHIVE) v$(VERSION)

distclean: clean
@$(RM) *~
@$(RM) *~

release: dist
@printf " RELEASE ../$(ARCHIVE)\n"
@(cd ..; md5sum $(ARCHIVE) > $(ARCHIVE).md5)

0 comments on commit 8532dab

Please sign in to comment.