-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
146 lines (109 loc) · 2.92 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
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
146
ifeq (,$(wildcard config.mak))
$(error "config.mak is not present, run configure !")
endif
include config.mak
PKGCONFIG_DIR = $(libdir)/pkgconfig
PKGCONFIG_FILE = libnfo.pc
NFO_READER = libnfo-reader
NFO_READER_SRCS = libnfo-reader.c
NFO_READER_OBJS = $(NFO_READER_SRCS:.c=.o)
NFO_READER_MAN = $(NFO_READER).1
APPS_CPPFLAGS = -Isrc $(CFG_CPPFLAGS) $(CPPFLAGS)
APPS_LDFLAGS = -Lsrc -lnfo $(CFG_LDFLAGS) $(LDFLAGS)
MANS = $(NFO_READER_MAN)
ifeq ($(BUILD_STATIC),yes)
ifeq ($(BUILD_SHARED),no)
APPS_LDFLAGS += $(EXTRALIBS)
endif
endif
DISTFILE = libnfo-$(VERSION).tar.bz2
EXTRADIST = \
AUTHORS \
ChangeLog \
configure \
COPYING \
README \
$(MANS) \
SUBDIRS = \
DOCS \
src \
.SUFFIXES: .c .o
all: lib apps docs
.c.o:
$(CC) -c $(OPTFLAGS) $(CFLAGS) $(APPS_CPPFLAGS) -o $@ $<
config.mak: configure
@echo "############################################################"
@echo "####### Please run ./configure again - it's changed! #######"
@echo "############################################################"
lib:
$(MAKE) -C src
$(NFO_READER): $(NFO_READER_OBJS)
$(CC) $(NFO_READER_OBJS) $(APPS_LDFLAGS) -o $(NFO_READER)
apps-dep:
$(CC) -MM $(CFLAGS) $(APPS_CPPFLAGS) $(NFO_READER_SRCS) 1>.depend
apps: apps-dep lib
$(MAKE) $(NFO_READER)
docs:
$(MAKE) -C DOCS
docs-clean:
$(MAKE) -C DOCS clean
clean:
$(MAKE) -C src clean
rm -f *.o
rm -f $(NFO_READER)
rm -f .depend
distclean: clean docs-clean
rm -f config.log
rm -f config.mak
rm -f $(DISTFILE)
rm -f $(PKGCONFIG_FILE)
install: install-lib install-pkgconfig install-apps install-docs install-man
install-lib: lib
$(MAKE) -C src install
install-pkgconfig: $(PKGCONFIG_FILE)
$(INSTALL) -d "$(PKGCONFIG_DIR)"
$(INSTALL) -m 644 $< "$(PKGCONFIG_DIR)"
install-apps: apps
$(INSTALL) -d $(bindir)
$(INSTALL) -c -m 755 $(NFO_READER) $(bindir)
install-docs: docs
$(MAKE) -C DOCS install
install-man: $(MANS)
for m in $(MANS); do \
section=`echo $$m | sed -e 's/^.*\\.//'`; \
$(INSTALL) -d $(mandir)/man$$section; \
$(INSTALL) -m 644 $$m $(mandir)/man$$section; \
done
uninstall: uninstall-lib uninstall-pkgconfig uninstall-apps uninstall-docs uninstall-man
uninstall-lib:
$(MAKE) -C src uninstall
uninstall-pkgconfig:
rm -f $(PKGCONFIG_DIR)/$(PKGCONFIG_FILE)
uninstall-apps:
rm -f $(bindir)/$(NFO_READER)
uninstall-docs:
$(MAKE) -C DOCS uninstall
uninstall-man:
for m in $(MANS); do \
section=`echo $$m | sed -e 's/^.*\\.//'`; \
rm -f $(mandir)/man$$section/$$m; \
done
.PHONY: *clean *install* docs apps*
dist:
-$(RM) $(DISTFILE)
dist=$(shell pwd)/libnfo-$(VERSION) && \
for subdir in . $(SUBDIRS); do \
mkdir -p "$$dist/$$subdir"; \
$(MAKE) -C $$subdir dist-all DIST="$$dist/$$subdir"; \
done && \
tar cjf $(DISTFILE) libnfo-$(VERSION)
-$(RM) -rf libnfo-$(VERSION)
dist-all:
cp $(EXTRADIST) $(NFO_READER_SRCS) Makefile $(DIST)
.PHONY: dist dist-all
#
# include dependency files if they exist
#
ifneq ($(wildcard .depend),)
include .depend
endif