2021-07-30 19:13:00 +03:00
|
|
|
OBJS=hibernation-setup-tool.o
|
2021-06-29 21:24:33 +03:00
|
|
|
CFLAGS+=-Os -Wall -Wextra -std=gnu11 -fstack-protector-all -D_FORTIFY_SOURCE=1
|
|
|
|
LDFLAGS+=-Wl,-z,relro,-z,now
|
2021-03-24 04:51:10 +03:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) -c $< $(CFLAGS) -o $@
|
|
|
|
|
2021-07-30 19:13:00 +03:00
|
|
|
hibernation-setup-tool: $(OBJS)
|
2021-03-24 04:51:10 +03:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $^
|
|
|
|
|
2021-07-30 19:13:00 +03:00
|
|
|
all: hibernation-setup-tool
|
2021-03-24 04:51:10 +03:00
|
|
|
|
2022-07-11 22:59:08 +03:00
|
|
|
debug: CFLAGS += -DDEBUG -g -O0
|
2022-06-25 02:48:38 +03:00
|
|
|
debug: hibernation-setup-tool
|
|
|
|
|
2021-03-24 04:51:10 +03:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJS)
|
2021-07-30 19:13:00 +03:00
|
|
|
rm -f hibernation-setup-tool
|
2021-03-24 04:51:10 +03:00
|
|
|
|
2021-06-25 19:31:04 +03:00
|
|
|
.PHONY: install
|
2021-03-24 04:51:10 +03:00
|
|
|
install: all
|
2021-07-30 19:13:00 +03:00
|
|
|
ifneq (,$(wildcard hibernation-setup-tool.1))
|
2021-06-29 22:07:22 +03:00
|
|
|
install -m 0755 -d $(DESTDIR)/usr/share/man/man1/
|
2021-07-30 19:13:00 +03:00
|
|
|
install -m 0644 hibernation-setup-tool.1 $(DESTDIR)/usr/share/man/man1/
|
2021-06-29 22:07:22 +03:00
|
|
|
endif
|
2021-03-24 06:58:28 +03:00
|
|
|
install -m 0755 -d $(DESTDIR)/usr/sbin
|
2021-03-24 07:07:07 +03:00
|
|
|
install -m 0755 -d $(DESTDIR)/lib/systemd/system/
|
2021-07-30 19:13:00 +03:00
|
|
|
install -m 0755 hibernation-setup-tool $(DESTDIR)/usr/sbin
|
|
|
|
install -m 0644 hibernation-setup-tool.service $(DESTDIR)/lib/systemd/system
|
2021-06-25 19:31:04 +03:00
|
|
|
|
|
|
|
.PHONY: indent
|
|
|
|
indent:
|
2021-07-30 19:13:00 +03:00
|
|
|
clang-format hibernation-setup-tool.c > indented.c
|
|
|
|
mv indented.c hibernation-setup-tool.c
|
2021-06-29 22:07:22 +03:00
|
|
|
|
2021-07-30 19:13:00 +03:00
|
|
|
hibernation-setup-tool.1: README.md
|
|
|
|
pandoc -f markdown -s -t man README.md -o hibernation-setup-tool.1
|