f888b582f9
Changes included in this set: * Added strlcat() and strlcpy() from OpenBSD, always use them if the system does not have them built in. * Changed an array of PATH_MAX size allocated in the stack, to a dynamically allocated buffer from heap. This should reduce memory usage a bit. * Simplify code that implemented a homegrown realpath(3) implementation, simply use realpath(3). * If compiler supports -fstack-protector, build all code with -D_FORTIFY_SOURCE=2 and --param ssp-buffer-size=1 so that all buffers are protected.
46 lines
969 B
Makefile
46 lines
969 B
Makefile
-include $(TOPDIR)/config.mk
|
|
|
|
OBJS ?= main.o
|
|
CFLAGS += $(PROG_CFLAGS)
|
|
LDFLAGS += -lxbps
|
|
|
|
.PHONY: all
|
|
all: $(BIN) $(BIN).static
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
-rm -f $(BIN) $(BIN).static
|
|
-rm -f $(OBJS)
|
|
|
|
.PHONY: install
|
|
install: all
|
|
install -d $(DESTDIR)$(SBINDIR)
|
|
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(DESTDIR)$(SBINDIR)
|
|
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(DESTDIR)$(SBINDIR)
|
|
ifdef MAN
|
|
install -d $(DESTDIR)$(MANDIR)/man8
|
|
install -m 644 $(MAN) $(DESTDIR)$(MANDIR)/man8
|
|
endif
|
|
|
|
.PHONY: uninstall
|
|
uninstall:
|
|
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN)
|
|
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN).static
|
|
ifdef MAN
|
|
-rm -f $(DESTDIR)$(MANDIR)/man8/$(MAN)
|
|
endif
|
|
|
|
%.o: %.c
|
|
@printf " [CC]\t\t$@\n"
|
|
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
|
|
|
$(BIN).static: $(OBJS)
|
|
@printf " [CCLD]\t\t$@\n"
|
|
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
|
$(STATIC_LIBS) -o $@
|
|
|
|
$(BIN): $(OBJS)
|
|
@printf " [CCLD]\t\t$@\n"
|
|
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(PROG_LDFLAGS) -o $@
|
|
|