Annotation of embedaddon/libpdel/Makefile, revision 1.1.1.1
1.1 misho 1: # $Id: Makefile,v 1.61 2004/07/29 00:59:36 archie Exp $
2:
3: LIB= pdel
4:
5: SUBDIRS= config http io net ppp structs sys tmpl util
6:
7: VERSION!= grep -w PDEL_VERSION_STRING ${.CURDIR}/version.h \
8: | awk '{ print $$NF }' | sed 's/"//g'
9: VERSION_MAJOR= ${VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/g}
10: VERSION_MINOR= ${VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/g}
11: VERSION_PATCH= ${VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/g}
12:
13: PREFIX?= /usr/local
14: PDELTOP= ${.CURDIR}
15: LIBSUFX= lib
16: LIBDIR= ${PREFIX}/${LIBSUFX}
17: SHLIBDIR= ${PREFIX}/${LIBSUFX}
18: MANSUFX= man/man
19: MANDIR= ${PREFIX}/${MANSUFX}
20: INCSUFX= include/pdel
21: INCDIR= ${PREFIX}/${INCSUFX}
22: OBJDIR= ${PDELTOP}/obj
23: SHLIB_MAJOR= ${VERSION_MAJOR}
24: MAN= libpdel.3
25: NOPROFILE=
26: INCHDRS= version.h
27:
28: # Uncomment to get debug symbols
29: #CFLAGS+=-g
30: #STRIP=
31:
32: #
33: # Read in info from subdirectories
34: #
35: .for DIR in ${SUBDIRS}
36: .include "${DIR}/Makefile.inc"
37: .for PDIR in ${${DIR}_PATH}
38: .PATH: ${PDIR}
39: SRCDIRS+= ${PDIR}
40: .endfor
41: SRCS+= ${${DIR}_SRCS}
42: INCHDRS+= ${${DIR}_INCS:S/^/${DIR}\//g}
43: MAN+= ${${DIR}_MAN:S/^/${DIR}\//g}
44: MLINKS+= ${${DIR}_MLINKS}
45: .endfor
46:
47: CFLAGS+= -I${PDELTOP}
48: CFLAGS+= -I${PREFIX}/include
49: CFLAGS+= -DTYPED_MEM_UNDEFINE_ORIGINALS
50:
51: CLEANFILES+= ${.CURDIR}/freebsd.port/pdel-port.tgz
52:
53: #
54: # Cleaning up
55: #
56: extra_clean: cleandir
57: ( cd ${.CURDIR} && find -E ${.CURDIR} \
58: -regex '.*/(tags|.*\.orig|xx)' | xargs rm )
59: @if [ -d ${.CURDIR}/freebsd.port ]; then \
60: cd ${.CURDIR}/freebsd.port && ${MAKE} cleandir; \
61: fi
62: @for DIR in ${SUBDIRS}; do \
63: TDIRS=`find ${.CURDIR}/$${DIR} -type d -a -name '*test*'`; \
64: for TDIR in $${TDIRS}; do \
65: ( cd $${TDIR} && ${MAKE} cleandir ); \
66: done; \
67: done
68:
69: .if !defined(EXTRA_CLEAN)
70: clean cleandir distclean:
71: cd ${.CURDIR} && ${MAKE} extra_clean EXTRA_CLEAN=
72: .endif
73:
74: #
75: # Handle installation of #include files
76: #
77: beforeinstall: includedirs includefiles
78:
79: #
80: # Create #include subdirectories
81: #
82: includedirs:
83: @INCDIRS=`echo ${INCHDRS} | fmt 2 | grep / \
84: | sed -E 's,^(.*)/[^/]+$$,\1,g' | sort | uniq`; \
85: for DIR in $${INCDIRS}; do \
86: if ! [ -d ${DESTDIR}${INCDIR}$${DIR} ]; then \
87: echo ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 0755 \
88: ${DESTDIR}${INCDIR}/$${DIR}; \
89: ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m 0755 \
90: ${DESTDIR}${INCDIR}/$${DIR}; \
91: fi; \
92: done
93:
94: #
95: # Install header files
96: #
97: includefiles:
98: @for HDR in ${INCHDRS}; do \
99: echo ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m \
100: ${SHAREMODE} ${PDELTOP}/$${HDR} \
101: ${DESTDIR}${INCDIR}/$${HDR}; \
102: ${INSTALL} -C -o ${SHAREOWN} -g ${SHAREGRP} -m \
103: ${SHAREMODE} ${PDELTOP}/$${HDR} \
104: ${DESTDIR}${INCDIR}/$${HDR}; \
105: done
106:
107: #
108: # Print out all created directories
109: #
110: dirlist:
111: @INCDIRS=`echo ${INCHDRS} | fmt 2 | grep / \
112: | sed -E 's,^(.*)/[^/]+$$,\1,g' | sort | uniq`; \
113: for DIR in $${INCDIRS}; do \
114: echo ${INCSUFX}/$${DIR}; \
115: done; \
116: echo ${INCSUFX}
117:
118: #
119: # Print out all installed files
120: #
121: filelist:
122: @( cd ${.CURDIR} && ${MAKE} filelist-unsorted | sort )
123:
124: filelist-unsorted:
125: @echo ${LIBSUFX}/libpdel.a
126: @echo ${LIBSUFX}/libpdel.so
127: @echo ${LIBSUFX}/libpdel.so.${SHLIB_MAJOR}
128: @for HDR in ${INCHDRS}; do \
129: echo ${INCSUFX}/$${HDR}; \
130: done
131: @set `echo ${MAN} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
132: while : ; do \
133: case $$# in \
134: 0) break;; \
135: 1) echo "warn: missing extension: $$1"; break;; \
136: esac; \
137: page=`basename $$1`; shift; sect=$$1; shift; \
138: ${ECHO} ${MANSUFX}$${sect}/$${page}.gz; \
139: done
140: @set `echo ${MLINKS} " " | sed 's/\.\([^.]*\) /.\1 \1 /g'`; \
141: while : ; do \
142: case $$# in \
143: 0) break;; \
144: [123]) echo "warn: empty MLINK: $$1 $$2 $$3"; break;; \
145: esac; \
146: shift; shift; page=`basename $$1`; shift; sect=$$1; shift; \
147: ${ECHO} ${MANSUFX}$${sect}/$${page}.gz; \
148: done
149:
150: #
151: # Create distribution tarball, including substituted copyright notices
152: #
153: COPYRIGHT_TAG= @COPYRIGHT@
154: COPYRIGHT_FILE= ${.CURDIR}/COPYRIGHT
155:
156: tarball: ${COPYRIGHT_FILE}
157: ( cd ${.CURDIR} && ${MAKE} cleandir )
158: rm -f ${.CURDIR}/GNUmakefile
159: ( cd ${.CURDIR} && ${MAKE} ${.CURDIR}/GNUmakefile )
160: rm -rf libpdel-${VERSION}
161: mkdir libpdel-${VERSION}
162: ( cd ${.CURDIR} && find COPYRIGHT README Changes *akefile* libpdel.3 \
163: ports debug version.h ${SUBDIRS} \( -name CVS -a -prune \) \
164: -o -type f -print | cpio -pudml ${OBJDIR}/libpdel-${VERSION} )
165: FILES=`find ${OBJDIR}/libpdel-${VERSION} -type f -print`; \
166: for f in $${FILES}; do \
167: if [ "$${f}" != "${OBJDIR}/libpdel-${VERSION}/Makefile" ] \
168: && grep -q '${COPYRIGHT_TAG}' $${f}; then \
169: echo substituting '${COPYRIGHT_TAG}' in $${f}; \
170: LINE=`grep -n '${COPYRIGHT_TAG}' $${f} \
171: | head -1 | awk -F: '{print $$1}'`; \
172: TAIL=`grep -n '${COPYRIGHT_TAG}' $${f} \
173: | head -1 | awk -F: '{print $$2}' \
174: | sed -e 's/\\\\/\\\\\\\\/g' -e 's/"/\\\\"/g'`; \
175: PREFX=`echo "$${TAIL}" \
176: | sed -E 's/^(.*)${COPYRIGHT_TAG}(.*)$$/\\1/g'`; \
177: SUFFX=`echo "$${TAIL}" \
178: | sed -E 's/^(.*)${COPYRIGHT_TAG}(.*)$$/\\2/g'`; \
179: if [ "$${LINE}" -gt 1 ]; then \
180: head -`expr $${LINE} - 1` < $${f} > $${f}.new; \
181: else \
182: cat /dev/null > $${f}.new; \
183: fi; \
184: awk "{ printf \"%s%s%s\\n\", \
185: \"$${PREFX}\", \$$0, \"$${SUFFX}\" }" \
186: < ${COPYRIGHT_FILE} >> $${f}.new; \
187: tail +`expr $${LINE} + 1` < $${f} >> $${f}.new; \
188: mv $${f}.new $${f}; \
189: fi; \
190: done
191: ( cd ${OBJDIR} && tar cf - libpdel-${VERSION} ) \
192: | gzip --best > ${.CURDIR}/libpdel-${VERSION}.tar.gz
193:
194: CLEANFILES+= ${.CURDIR}/libpdel-${VERSION}.tar.gz
195: CLEANDIRS+= ${OBJDIR}/libpdel-${VERSION}
196:
197: .if make(${.CURDIR}/GNUmakefile)
198: #
199: # Create a GNUmakefile for Linux
200: #
201: L_OMIT= (bpf|fs_mount|if_arp|if_iface|if_ip|if_util|route_msg|uroute|ppp_|pdel_ppp)
202:
203: L_SRCS!= echo ${SRCS} | fmt -w 1 | grep -vE '${L_OMIT}'
204: L_MAN!= echo ${MAN} | fmt -w 1 | grep -vE '${L_OMIT}'
205: L_HDRS!= echo ${HDRS} | fmt -w 1 | grep -vE '${L_OMIT}'
206: L_INCS!= echo ${INCHDRS} | fmt -w 1 | grep -vE '${L_OMIT}'
207: L_MLINKS!= set `echo ${MLINKS}`; \
208: while : ; do \
209: case $$\# in \
210: 0) break;; \
211: 1) echo "warn: empty MLINK: $$1"; break;; \
212: esac; \
213: if ! echo $$1 $$2 | grep -qE "${L_OMIT}"; then \
214: echo $$1 $$2; \
215: fi; \
216: shift; shift; \
217: done
218: L_CFLAGS= ${CFLAGS:S/${PDELTOP}/\$(srcdir)/g}
219: L_SRCDIRS= ${SRCDIRS:S/${PDELTOP}/\$(srcdir)/g:S/-DTYPED_MEM_UNDEFINE_ORIGINALS//g}
220:
221: ${.CURDIR}/GNUmakefile: ${.CURDIR}/Makefile ${.CURDIR}/GNUmakefile.in
222: @echo creating ${.TARGET}
223: @sed -e 's,\$$\I\d: .*$$,Note: generated file,g' \
224: -e 's,@SRCS@,${L_SRCS},g' \
225: -e 's,@SRCDIRS@,${L_SRCDIRS},g' \
226: -e 's,@INCS@,${L_INCS},g' \
227: -e 's,@MAN@,${L_MAN},g' \
228: -e 's,@MLINKS@,${L_MLINKS},g' \
229: -e 's,@SUBDIRS@,${L_SUBDIRS},g' \
230: -e 's,@CFLAGS@,${L_CFLAGS},g' \
231: -e 's,@VERSION_MAJOR@,${VERSION_MAJOR},g' \
232: -e 's,@VERSION_MINOR@,${VERSION_MINOR},g' \
233: -e 's,@VERSION_PATCH@,${VERSION_PATCH},g' \
234: < ${.CURDIR}/GNUmakefile.in > ${.TARGET}
235: .endif
236:
237: #
238: # Print out version
239: #
240: version:
241: @echo ${VERSION}
242:
243: .include "${PDELTOP}/Makefile.inc"
244: .include <bsd.lib.mk>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>