summaryrefslogtreecommitdiff
path: root/.local/bin/setup
blob: e26c590c085cb18d535529e6bacedd5a230e24cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/make -f

HOME = $(shell cd "$(dir $(lastword $(MAKEFILE_LIST)))" && git rev-parse --show-toplevel)
export HOME
undefine XDG_CONFIG_DIR

LANG = C
export LANG
undefine $(filter LC_%,$(.VARIABLES))

CFLAGS += -std=c99 -Wall -Wextra -Werror -Wno-unused-parameter

dirs = \
	$(HOME)/packages/pkgdest \
	$(HOME)/packages/srcdest \
	$(HOME)/packages/srcpkgdest \
	$(HOME)/packages/logdest \
	$(HOME)/packages/builddir

all: \
	$(HOME)/.local/bin/autobuild \
	$(HOME)/.ssh/id_rsa \
	$(HOME)/.ssh/id_rsa.pub \
	$(HOME)/.gnupg/secring.gpg \
	$(HOME)/packages/abslibre \
	$(dirs)

$(HOME)/.local/bin/autobuild: %: %.c
	cd $(@D) && $(LINK.c) $(notdir $^) $(LOADLIBES) $(LDLIBS) -o $(@F) && chmod 6755 $(@F)

$(HOME)/.ssh/id_% $(HOME)/.ssh/id_%.pub:
	ssh-keygen -N '' -f $(@D)/id_$*

$(HOME)/.gnupg/secring.gpg: | $(HOME)/.config/git/config
	chmod 700 $(@D)
	printf '%s\n' \
		'Key-Type: default' \
		'Subkey-Type: default' \
		"Name-Real: $$(git config user.name)" \
		"Name-Email: $$(git config user.email)" \
		'Expire-Date: 0' \
	| gpg --gen-key --batch

$(HOME)/packages/abslibre:
	createworkdir

$(dirs): %:
	mkdir -p -- $@

.DELETE_ON_ERROR: