forked from fairyglade/ly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
executable file
·67 lines (50 loc) · 1.53 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
######## CONFIG ########
NAME := ly
CXX := cc
INSTALL = ln -sf /usr/lib/security/pam_loginuid.so ${DESTDIR}/usr/lib/pam_loginuid.so
SRCD := src
INCD := src
BIND := build
OBJD := obj
DEPD := dep
LIBS := -lform -lncurses -lpam -lpam_misc -lX11
LIBSUSR = -L/usr/lib/security -l:pam_loginuid.so
VPATH = $(SRCD) $(INCD) $(OBJD) $(DEPD)
######## STOP ########
SRCS := $(call rwildcard,$(SRCD)/,*.c)
OBJS := $(patsubst $(SRCD)/%.c,$(OBJD)/%.o,$(SRCS))
DEPS := $(patsubst $(SRCD)/%.c,$(DEPD)/%.d,$(SRCS))
CXXFLAGS := -Wall -g -I$(INCD)
LDDFLAGS := $(LIBS)
.PHONY: all install uninstall clean distclean
.PRECIOUS: $(DEPD)/%.d
all: $(BIND)/$(NAME)
$(DEPD)/%.d : $(SRCD)/%.c
@echo "listing dependencies for source file $<"
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) -M -c $< -o $@
$(OBJD)/%.o : $(SRCD)/%.c $(DEPD)/%.d
@echo "building object $@"
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) -c $< -o $@
$(BIND)/$(NAME): $(OBJS)
@echo "compiling $@"
@mkdir -p $(BIND)
@$(CXX) $(CXXFLAGS) $(LDDFLAGS) $(OBJS) -o $(BIND)/$(NAME)
install : $(BIND)/$(NAME)
install -dZ ${DESTDIR}/etc/ly
install -DZ $(BIND)/$(NAME) -t ${DESTDIR}/usr/bin
install -DZ xsetup.sh -t ${DESTDIR}/etc/ly
install -DZ ly.service -t ${DESTDIR}/usr/lib/systemd/system
$(INSTALL)
uninstall:
rm -rf ${DESTDIR}/etc/ly
rm -f ${DESTDIR}/usr/bin/ly
rm -f ${DESTDIR}/usr/lib/systemd/system/ly.service
clean:
@echo "cleaning workspace"
@rm -rf $(BIND)
@rm -rf $(OBJD)
@rm -rf $(DEPD)
distclean: clean