-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
34 lines (29 loc) · 960 Bytes
/
Makefile
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
CFLAGS:=-O2 -Wall -Werror -Wpointer-arith -fPIC $(CFLAGS)
INSTALL_FOLDER:=/lib/x86_64-linux-gnu
VERSION:=2
LIB_NAME:=libnss_homehosts.so
LIB_NAME_WITH_VERSION:=$(LIB_NAME).$(VERSION)
.PHONY: all
all: $(LIB_NAME_WITH_VERSION)
$(LIB_NAME_WITH_VERSION): libnss_homehosts.o
$(CC) $(CFLAGS) -shared -o $@ $<
libnss_homehosts.o: libnss_homehosts.c
$(CC) $(CFLAGS) -c -o $@ $<
.PHONY: clean
clean:
rm -f $(LIB_NAME) libnss_homehosts.o
.PHONY: install
install: $(LIB_NAME)
install -m 644 $< $(INSTALL_FOLDER)
rm -f $(INSTALL_FOLDER)/$(LIB_NAME_WITH_VERSION)
ln -s $(LIB_NAME) $(INSTALL_FOLDER)/$(LIB_NAME_WITH_VERSION)
ldconfig
.PHONY: uninstall
uninstall:
rm -f $(INSTALL_FOLDER)/$(LIB_NAME)
rm -f $(INSTALL_FOLDER)/$(LIB_NAME_WITH_VERSION)
.PHONY: test
test:
echo 198.18.1.1 libnss-homehost.test.example.net >> ~/.hosts
getent -s homehosts hosts libnss-homehost.test.example.net
sed -e '/^198.18.1.1 libnss-homehost.test.example.net$/d' -i ~/.hosts