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

Contents of /portage-utils/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.77 - (show annotations) (download)
Tue Feb 18 07:31:33 2014 UTC (8 weeks, 3 days ago) by vapier
Branch: MAIN
Changes since 1.76: +3 -2 lines
build with -Wold-style-definition to weed out old bad func definitions

1 # Copyright 2005-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-projects/portage-utils/Makefile,v 1.76 2013/09/29 22:12:51 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 WFLAGS := -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
11 -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
12 -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
13 -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
14 $(call check_gcc, -Wsequence-point) \
15 $(call check_gcc, -Wextra) \
16 $(call check_gcc, -Wno-sign-compare) \
17 $(call check_gcc, -Wold-style-definition)
18
19 CFLAGS ?= -O2 -g -pipe
20 CFLAGS += -std=gnu99
21 CPPFLAGS ?=
22 #CFLAGS += -DEBUG -g
23 #CFLAGS += -Os -DOPTIMIZE_FOR_SIZE=2 -falign-functions=2 -falign-jumps=2 -falign-labels=2 -falign-loops=2
24 #LDFLAGS := -pie
25 LIBADD += $(shell echo | $(CC) -dM -E - | grep -q ' __FreeBSD__' && echo '-lkvm')
26 DESTDIR :=
27 PREFIX := $(DESTDIR)/usr
28 STRIP := strip
29 MKDIR := mkdir -p
30 CP := cp
31
32 ifndef V
33 Q = @
34 else
35 Q =
36 endif
37 ifdef PV
38 CPPFLAGS += -DVERSION=\"$(PV)\"
39 else
40 PV := cvs
41 endif
42 ifndef PF
43 PF := portage-utils-$(PV)
44 endif
45 DOCS := TODO README qsync
46
47 #ifdef PYTHON
48 #PYFLAGS ?= $(shell python-config) -DWANT_PYTHON -ldl -pthread -lutil /usr/lib/libpython2.4.so
49 ##PYFLAGS += -lpython2.4
50 #endif
51
52 #####################################################
53 APPLETS := $(shell ./applets.sh)
54 SRC := $(APPLETS:%=%.c) main.c
55 APP_FLAGS := $(foreach a,$(APPLETS),-DAPPLET_$a)
56 CPPFLAGS += $(APP_FLAGS)
57
58 all: q
59 @true
60
61 debug:
62 $(MAKE) CFLAGS="$(CFLAGS) -O0 -DEBUG -g3 -ggdb -fno-pie" clean symlinks
63 @-scanelf -o /dev/null -BXxz permsx q
64
65 q: $(SRC) libq/*.c *.h libq/*.h
66 ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
67 @printf ': %s ' $(APPLETS)
68 @echo ':'
69 ifndef V
70 @echo $(CC) $(CFLAGS) $(PYFLAGS) $(LDFLAGS) main.c -o q $(LIBADD)
71 endif
72 endif
73 $(Q)$(CC) $(WFLAGS) $(PYFLAGS) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) main.c -o q $(LIBADD)
74
75 .depend: $(SRC)
76 sed -n '/^DECLARE_APPLET/s:.*(\(.*\)).*:#include "\1.c":p' applets.h > include_applets.h
77 @#$(CC) $(CFLAGS) -MM $(SRC) > .depend
78 $(CC) $(CPPFLAGS) $(CFLAGS) -MM main.c > .depend
79
80 check: symlinks
81 $(MAKE) -C tests $@
82
83 dist:
84 ./make-tarball.sh $(PV)
85 distcheck: dist
86 rm -rf portage-utils-$(PV)
87 tar xf portage-utils-$(PV).tar.xz
88 $(MAKE) -C portage-utils-$(PV)
89 $(MAKE) -C portage-utils-$(PV) check
90 rm -rf portage-utils-$(PV)
91
92 clean:
93 -rm -f q $(APPLETS)
94 $(MAKE) -C tests clean
95 distclean: clean testclean
96 -rm -f *~ core .#*
97 -rm -f `find . -type l`
98
99 testclean:
100 cd tests && $(MAKE) clean
101
102 install: all
103 -$(MKDIR) $(PREFIX)/bin/
104 $(CP) q $(PREFIX)/bin/
105 if [ ! -d CVS ] ; then \
106 $(MKDIR) $(PREFIX)/share/man/man1/ ; \
107 for mpage in $(wildcard man/*.1) ; do \
108 [ -e $$mpage ] \
109 && cp $$mpage $(PREFIX)/share/man/man1/ || : ;\
110 done ; \
111 $(MKDIR) $(PREFIX)/share/doc/$(PF) ; \
112 for doc in $(DOCS) ; do \
113 cp $$doc $(PREFIX)/share/doc/$(PF)/ ; \
114 done ; \
115 fi
116 (cd $(PREFIX)/bin/ ; \
117 for applet in $(APPLETS); do \
118 [ ! -e "$$applet" ] && ln -s q $${applet} ; \
119 done \
120 )
121
122 man: q
123 ./man/mkman.py
124
125 symlinks: all
126 ./q --install
127
128 -include .depend
129
130 .PHONY: all check clean debug dist distclean install man symlinks testclean
131
132 #
133 # All logic related to autotools is below here
134 #
135 GEN_MARK_START = \# @@@ GEN START @@@ \#
136 GEN_MARK_END = \# @@@ GEN START @@@ \#
137 EXTRA_DIST = \
138 $(SRC) \
139 qglsa.c \
140 $(wildcard libq/*.c *.h libq/*.h) \
141 $(shell find tests -type f '!' -ipath '*/CVS/*')
142 MAKE_MULTI_LINES = $(patsubst %,\\\\\n\t%,$(sort $(1)))
143 # 2nd level of indirection here is so the $(find) doesn't pick up
144 # files in EXTRA_DIST that get cleaned up ...
145 autotools-update: clean
146 $(MAKE) _autotools-update
147 _autotools-update:
148 sed -i '/^$(GEN_MARK_START)$$/,/^$(GEN_MARK_END)$$/d' Makefile.am
149 printf '%s\nq_CPPFLAGS += %b\ndist_man_MANS += %b\nAPPLETS += %b\nEXTRA_DIST += %b\n%s\n' \
150 "$(GEN_MARK_START)" \
151 "$(call MAKE_MULTI_LINES,$(APP_FLAGS))" \
152 "$(call MAKE_MULTI_LINES,$(wildcard man/*.1))" \
153 "$(call MAKE_MULTI_LINES,$(APPLETS))" \
154 "$(call MAKE_MULTI_LINES,$(EXTRA_DIST))" \
155 "$(GEN_MARK_END)" \
156 >> Makefile.am
157 autotools: autotools-update
158 ./autogen.sh --from=make
159
160 .PHONY: autotools autotools-update _autotools-update

  ViewVC Help
Powered by ViewVC 1.1.20