/[gentoo-projects]/pax-utils/Makefile
Gentoo

Contents of /pax-utils/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.80 - (show annotations) (download)
Thu Nov 15 20:14:41 2012 UTC (2 years, 1 month ago) by vapier
Branch: MAIN
Changes since 1.79: +4 -1 lines
install lddtree.py if USE_PYTHON=yes is set

1 # Copyright 2003-2006 Ned Ludd <solar@linbsd.net>
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.79 2012/02/04 18:22:37 vapier Exp $
4 ####################################################################
5
6 check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
7 then echo "$(1)"; else echo "$(2)"; fi)
8
9 ####################################################################
10 # Avoid CC overhead when installing
11 ifneq ($(MAKECMDGOALS),install)
12 WFLAGS := -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
13 -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \
14 -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
15 -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
16 $(call check_gcc, -Wdeclaration-after-statement) \
17 $(call check-gcc, -Wsequence-point) \
18 $(call check-gcc, -Wstrict-overflow) \
19 $(call check-gcc, -Wextra)
20 endif
21
22 CFLAGS ?= -O2 -pipe
23 override CPPFLAGS += -D_GNU_SOURCE
24 LDFLAGS +=
25 LIBS :=
26 DESTDIR =
27 PREFIX = $(DESTDIR)/usr
28 DATADIR = $(PREFIX)/share
29 MANDIR = $(DATADIR)/man
30 DOCDIR = $(DATADIR)/doc
31 PKGDOCDIR = $(DOCDIR)/pax-utils
32 STRIP := strip
33 MKDIR := mkdir -p
34 INS_EXE := install -m755
35 INS_DATA := install -m644
36
37 # Some fun settings
38 #CFLAGS += -DEBUG -g
39 #LDFLAGS += -pie
40
41 ifeq ($(USE_CAP),yes)
42 CPPFLAGS-pspax.c += -DWANT_SYSCAP
43 LIBS-pspax += -lcap
44 endif
45
46 ifdef PV
47 override CPPFLAGS += -DVERSION=\"$(PV)\"
48 endif
49
50 ####################################################################
51 ELF_TARGETS = scanelf dumpelf $(shell echo | $(CC) -dM -E - | grep -q __svr4__ || echo pspax)
52 ELF_OBJS = paxelf.o
53 MACH_TARGETS = scanmacho
54 MACH_OBJS = paxmacho.o
55 COMMON_OBJS = paxinc.o xfuncs.o
56 TARGETS = $(ELF_TARGETS) $(MACH_TARGETS)
57 OBJS = $(ELF_OBJS) $(MACH_OBJS) $(COMMON_OBJS) $(TARGETS:%=%.o)
58 MPAGES = $(TARGETS:%=man/%.1)
59 SOURCES = $(OBJS:%.o=%.c)
60
61 all: $(OBJS) $(TARGETS)
62 @:
63
64 debug: clean
65 $(MAKE) CFLAGS="$(CFLAGS) -g3 -ggdb $(call check-gcc,-nopie)" all
66 @-/sbin/chpax -permsx $(ELF_TARGETS)
67 @-/sbin/paxctl -permsx $(ELF_TARGETS)
68
69 compile.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS-$<) -o $@ -c $<
70
71 ifeq ($(V),)
72 Q := @
73 else
74 Q :=
75 endif
76 %.o: %.c
77 ifeq ($(V),)
78 @echo $(compile.c)
79 endif
80 $(Q)$(compile.c) $(WFLAGS)
81
82 $(ELF_TARGETS): %: $(ELF_OBJS) $(COMMON_OBJS) %.o
83 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) $(LIBS-$@)
84
85 $(MACH_TARGETS): %: $(MACH_OBJS) $(COMMON_OBJS) %.o
86 $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIBS) $(LIBS-$@)
87
88 %.so: %.c
89 $(CC) -shared -fPIC -o $@ $<
90
91 depend:
92 $(CC) $(CFLAGS) -MM $(SOURCES) > .depend
93
94 clean:
95 -rm -f $(OBJS) $(TARGETS)
96
97 distclean: clean
98 -rm -f *~ core *.o
99 -cd man && $(MAKE) clean
100 strip: all
101 $(STRIP) $(TARGETS)
102 strip-more:
103 $(STRIP) --strip-unneeded $(TARGETS)
104
105 install: all
106 $(MKDIR) $(PREFIX)/bin/ $(MANDIR)/man1/ $(PKGDOCDIR)/
107 for sh in *.sh ; do $(INS_EXE) $$sh $(PREFIX)/bin/$${sh%.sh} || exit $$? ; done
108 ifeq ($(USE_PYTHON),yes)
109 for py in *.py ; do $(INS_EXE) $$py $(PREFIX)/bin/$${py%.py} || exit $$? ; done
110 endif
111 $(INS_EXE) $(TARGETS) $(PREFIX)/bin/
112 $(INS_DATA) README BUGS TODO $(PKGDOCDIR)/
113 $(INS_DATA) $(MPAGES) $(MANDIR)/man1/
114
115 PN = pax-utils
116 P = $(PN)-$(PV)
117 dist:
118 @if [ "$(PV)" = "" ] ; then \
119 echo "Please run 'make dist PV=<ver>'" ; \
120 exit 1 ; \
121 fi
122 rm -rf $(P)
123 mkdir $(P)
124 cp -a CVS $(P)/
125 cd $(P) && cvs up
126 echo "<releaseinfo>$(PV)</releaseinfo>" > $(P)/man/fragment/version
127 $(MAKE) -C $(P)/man
128 tar cf - $(P) --exclude=CVS --exclude=.cvsignore | xz > $(P).tar.xz
129 @printf "\n ..... Making sure clean cvs build works ..... \n\n"
130 unset CFLAGS; \
131 for t in all check clean debug check ; do \
132 $(MAKE) -C $(P) $$t || exit $$? ; \
133 done
134 rm -rf $(P)
135 du -b $(P).tar.xz
136
137 -include .depend
138
139 check test:
140 $(MAKE) -C tests
141
142 .PHONY: all check clean dist install test

  ViewVC Help
Powered by ViewVC 1.1.20