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

Contents of /pax-utils/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.83 - (show annotations) (download)
Thu May 23 00:09:01 2013 UTC (15 months ago) by vapier
Branch: MAIN
Changes since 1.82: +2 -2 lines
use 64bit file interfaces even with 32bit processes #471024

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

  ViewVC Help
Powered by ViewVC 1.1.20