[go: up one dir, main page]

Menu

[3dc168]: / Makefile  Maximize  Restore  History

Download this file

146 lines (119 with data), 3.0 kB

  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
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
-include Config.mk
################ Source files ##########################################
exe := $O${name}
srcs := $(wildcard *.c)
objs := $(addprefix $O,$(srcs:.c=.o))
deps := ${objs:.o=.d}
confs := Config.mk config.h
oname := $(notdir $(abspath $O))
################ Compilation ###########################################
.SUFFIXES:
.PHONY: all clean distclean maintainer-clean
all: ${exe}
${exe}: ${objs}
@echo "Linking $@ ..."
@${CC} ${ldflags} -o $@ $^ ${libs}
$O%.o: %.c
@echo " Compiling $< ..."
@${CC} ${cflags} -MMD -MT "$(<:.c=.s) $@" -o $@ -c $<
%.s: %.c
@echo " Compiling $< to assembly ..."
@${CC} ${cflags} -S -o $@ -c $<
################ Installation ##########################################
.PHONY: install installdirs
.PHONY: uninstall uninstall-man uninstall-pam uninstall-svc
ifdef sbindir
exed := ${DESTDIR}${sbindir}
exei := ${exed}/$(notdir ${exe})
${exed}:
@echo "Creating $@ ..."
@${INSTALL} -d $@
${exei}: ${exe} | ${exed}
@echo "Installing $@ ..."
@${INSTALL_PROGRAM} $< $@
installdirs: ${exed}
install: ${exei}
uninstall:
@if [ -f ${exei} ]; then\
echo "Removing ${exei} ...";\
rm -f ${exei};\
fi
endif
ifdef man1dir
mand := ${DESTDIR}${man1dir}
mani := ${mand}/${name}.1
${mand}:
@echo "Creating $@ ..."
@${INSTALL} -d $@
${mani}: conf/${name}.1 | ${mand}
@echo "Installing $@ ..."
@${INSTALL_DATA} $< $@
installdirs: ${mand}
install: ${mani}
uninstall: uninstall-man
uninstall-man:
@if [ -f ${mani} ]; then\
echo "Removing ${mani} ...";\
rm -f ${mani};\
fi
endif
ifdef pamdir
pamd := ${DESTDIR}${pamdir}
pami := ${pamd}/${name}
${pamd}:
@echo "Creating $@ ..."
@${INSTALL} -d $@
${pami}: conf/${name} | ${pamd}
@echo "Installing $@ ..."
@${INSTALL_DATA} $< $@
installdirs: ${pamd}
install: ${pami}
uninstall: uninstall-pam
uninstall-pam:
@if [ -f ${pami} ]; then\
echo "Removing ${pami} ...";\
rm -f ${pami};\
fi
endif
ifdef sysddir
svcd := ${DESTDIR}${sysddir}
svci := ${svcd}/${name}@.service
${svcd}:
@echo "Creating $@ ..."
@${INSTALL} -d $@
${svci}: conf/${name}@.service | ${svcd}
@echo "Installing $@ ..."
@${INSTALL_DATA} $< $@
installdirs: ${svcd}
install: ${svci}
uninstall: uninstall-svc
uninstall-svc:
@if [ -f ${svci} ]; then\
echo "Removing ${svci} ...";\
rm -f ${svci};\
fi
endif
################ Maintenance ###########################################
clean:
@if [ -d ${builddir} ]; then\
rm -f ${exe} ${objs} ${deps} $O.d;\
rmdir ${builddir};\
fi
distclean: clean
@rm -f ${oname} ${confs} config.status
maintainer-clean: distclean
${builddir}/.d:
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
@touch $@
$O.d: | ${builddir}/.d
@[ -h ${oname} ] || ln -sf ${builddir} ${oname}
${objs}: Makefile ${confs} | $O.d
config.h: config.h.in | Config.mk
Config.mk: Config.mk.in
${confs}: configure
@if [ -x config.status ]; then echo "Reconfiguring ...";\
./config.status;\
else echo "Running configure ...";\
./configure;\
fi
-include ${deps}