File: Makefile

package info (click to toggle)
cruft-ng 0.4.7
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 152 kB
  • sloc: cpp: 779; ansic: 92; makefile: 37; sh: 9
file content (46 lines) | stat: -rw-r--r-- 1,934 bytes parent folder | download
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
CXXFLAGS ?= -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2
CXXFLAGS += -Wall
SHARED_OBJS = cruft.o dpkg_exclude.o explain.o filters.o mlocate.o shellexp.o usr_merge.o

all: cruft-ng
tests: test_mlocate test_explain test_filters test_excludes test_dpkg cruftlib

cruft.o: cruft.cc explain.h filters.h mlocate.h dpkg.h
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c cruft.cc

%.o: %.cc %.h
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c $<

dpkg_lib.o: dpkg_lib.cc dpkg.h
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c dpkg_lib.cc

dpkg_popen.o: dpkg_popen.cc dpkg.h
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c dpkg_popen.cc

shellexp.o: shellexp.c
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) -c shellexp.c

cruft-ng: $(SHARED_OBJS) dpkg_popen.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) $(SHARED_OBJS) dpkg_popen.o -o cruft-ng

cruftlib: $(SHARED_OBJS) dpkg_lib.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) $(SHARED_OBJS) dpkg_lib.o   -o cruftlib

test_%: %.o test_%.cc dpkg_popen.o usr_merge.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) $< $@.cc dpkg_popen.o usr_merge.o -o $@
test_dpkg: test_dpkg.cc dpkg_popen.o usr_merge.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) dpkg_popen.o usr_merge.o test_dpkg.cc -o $@
test_mlocate: mlocate.o test_mlocate.cc
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) mlocate.o test_mlocate.cc -o $@
test_excludes: dpkg_exclude.o test_excludes.cc
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(CPPFLAGS) dpkg_exclude.o test_excludes.cc -o $@

install: all
	#install -D -m 2755 -g mlocate cruft-ng   $(DESTDIR)/usr/bin/cruft-ng
	install -D -m 0755            cruft-ng   $(DESTDIR)/usr/bin/cruft-ng
	install -D -m 0644            cruft-ng.8 $(DESTDIR)/usr/share/man/man8/cruft-ng.8
	install -D -m 0644            README.md  $(DESTDIR)/usr/share/doc/cruft-ng/README.md

clean:
	rm -f cruft-ng cruftlib test_mlocate test_explain test_filters test_excludes test_dpkg
	rm -f *.o