aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 55ddd0a46495a9ddc2d60c1b0b1740021582db18 (plain) (blame)
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
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.  This file is offered as-is,
# without any warranty.

CONFIGFILE = config.mk
include $(CONFIGFILE)

all: bin/autopasswd

bin/autopasswd: obj/autopasswd.o
	@mkdir -p bin
	$(CC) -o $@ obj/autopasswd.o $(LDFLAGS)

obj/%.o: src/%.c
	@mkdir -p obj
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

install: bin/autopasswd
	mkdir -p -- "$(DESTDIR)$(BINDIR)"
	mkdir -p -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
	cp -- bin/autopasswd "$(DESTDIR)$(BINDIR)/$(COMMAND)"
	cp -- COPYING LICENSE "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/"

uninstall:
	-rm -f -- "$(DESTDIR)$(BINDIR)/$(COMMAND)"
	-rm -f -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
	-rm -f -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
	-rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"

clean:
	-rm -rf -- bin obj

.PHONY: all install uninstall clean