Skip to content

Commit

Permalink
Clean up the makefiles a bit and make them OBJDIR-safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
dag-erling committed Jul 9, 2013
1 parent 203e46a commit fd092c7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SUBDIR= external \
pkg \
scripts

NEWVERS= newvers.sh
NEWVERS= ${.CURDIR}/newvers.sh

.if !defined(NOSTATIC)
SUBDIR+= pkg-static
Expand Down Expand Up @@ -78,6 +78,6 @@ make-tarball:
-o ${TARBALL_FILE} ${PKGVERSION}

Doxyfile: Doxyfile.in ${NEWVERS} ${_snapshot}
sed -e 's,%%PKGVERSION%%,${PKGVERSION},' ${.TARGET:S,$,.in,} > ${.TARGET}
sed -e 's,%%PKGVERSION%%,${PKGVERSION},' ${.CURDIR}/${.TARGET:S,$,.in,} > ${.TARGET}

.include <bsd.subdir.mk>
15 changes: 8 additions & 7 deletions libpkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MAN= pkg_printf.3 \

CLEANFILES= ${PC} ${PKGH}

NEWVERS= ../newvers.sh
NEWVERS= ${.CURDIR}/../newvers.sh

PKGVERSION!= sh ${NEWVERS} pkg
PORTVERSION!= sh ${NEWVERS} port
Expand All @@ -65,7 +65,7 @@ ${_snapshot}:
all: ${PC}

realinstall: ${PC}
${INSTALL} -m 644 ${.OBJDIR}/${PC} ${DESTDIR}${PREFIX}/libdata/pkgconfig
${INSTALL} -m 644 ${PC} ${DESTDIR}${PREFIX}/libdata/pkgconfig

#
# Set DEFAULT_MIRROR_TYPE default to SRV
Expand All @@ -78,13 +78,14 @@ DEFAULT_MIRROR_TYPE?= 1

CFLAGS+= -DDEFAULT_MIRROR_TYPE=${DEFAULT_MIRROR_TYPE}
CFLAGS+= -std=c99
CFLAGS+= -I${.CURDIR} \
CFLAGS+= -I. \
-I${.CURDIR} \
-I${.CURDIR}/../external/sqlite \
-I${.CURDIR}/../external/uthash

.if !exists(/usr/include/bsdyml.h)
CFLAGS+= -DBUNDLED_YAML -I ${.CURDIR}/../external/libyaml/include
LDADD+= -L${.OBJDIR}/../external/libyaml -lyaml
LDADD+= -L../external/libyaml -lyaml
.else
LDADD+= -lbsdyml
.endif
Expand All @@ -94,11 +95,11 @@ CFLAGS+= -I${.CURDIR}/../external/libelf \
-DBUNDLED_LIBELF
.endif

LDADD+= -L${.OBJDIR}/../external/sqlite \
-L${.OBJDIR}/../external/libyaml
LDADD+= -L../external/sqlite \
-L../external/libyaml

.if defined(WITH_BUNDLED_LIBELF)
LDADD+= -L${.OBJDIR}/../external/libelf
LDADD+= -L../external/libelf
.endif

LDADD+= -lsqlite3 \
Expand Down
6 changes: 3 additions & 3 deletions pkg-static/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ STATIC_PKGNG= yes
NO_SHARED?= yes
NO_MAN= yes
NOMAN= yes
LDADD_STATIC= -L${.OBJDIR}/../external/sqlite
LDADD_STATIC= -L../external/sqlite

.if !exists(/usr/include/bsdyml.h)
LDADD_STATIC+= -L${.OBJDIR}/../external/libyaml \
LDADD_STATIC+= -L../external/libyaml \
-lyaml
.else
LDADD_STATIC+= -lbsdyml
.endif

.if defined(WITH_BUNDLED_LIBELF)
LDADD_STATIC+= -L${.OBJDIR}/../external/libelf
LDADD_STATIC+= -L../external/libelf
.endif

LDADD_STATIC+= -lsqlite3 \
Expand Down
6 changes: 3 additions & 3 deletions pkg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ DEBUG_FLAGS+= -ggdb -O0
DEBUG_FLAGS+= -pg
.endif

CFLAGS+= -I${.CURDIR}/../libpkg \
-I${.CURDIR}/../external/uthash
LDADD+= -L${.OBJDIR}/../libpkg \
CFLAGS+= -I../libpkg \
-I${.CURDIR}/../external/uthash
LDADD+= -L../libpkg \
-lpkg \
-larchive \
-lutil \
Expand Down
10 changes: 4 additions & 6 deletions scripts/completion/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,18 @@ PREFIX?= /usr/local
COMPLETION_SRCS= _pkg.bash.in \
_pkg.zsh.in
COMPLETION= ${COMPLETION_SRCS:R}
CLEANFILES= ${COMPLETION}

.in:
sed -e 's,__PREFIX__,${PREFIX},g' \
${.IMPSRC} > ${.TARGET}

all: ${COMPLETION}

clean:
rm -f ${.OBJDIR}/${COMPLETION}

install: all
install -d ${DESTDIR}${PREFIX}/share/zsh/site-functions/
install -d ${DESTDIR}${PREFIX}/etc/bash_completion.d/
install -m 444 ${.OBJDIR}/_pkg.bash ${DESTDIR}${PREFIX}/etc/bash_completion.d/
install -m 444 ${.OBJDIR}/_pkg.zsh ${DESTDIR}${PREFIX}/share/zsh/site-functions/_pkg
install -m 444 _pkg.bash ${DESTDIR}${PREFIX}/etc/bash_completion.d/
install -m 444 _pkg.zsh ${DESTDIR}${PREFIX}/share/zsh/site-functions/_pkg

.include <bsd.own.mk>
.include <bsd.prog.mk>
10 changes: 4 additions & 6 deletions scripts/periodic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,22 @@ SCRIPTS_DAILY= 400.status-pkg.in \
SCRIPTS_SECURITY= 410.pkg-audit.in \
460.pkg-checksum.in
SCRIPTS= ${SCRIPTS_DAILY:R} ${SCRIPTS_SECURITY:R}
CLEANFILES= ${SCRIPTS}

.in:
sed -e 's,__PREFIX__,${PREFIX},g' \
${.IMPSRC} > ${.TARGET}

all: ${SCRIPTS}

clean:
rm -f ${.OBJDIR}/${SCRIPTS}

install: all
install -d ${DESTDIR}${PREFIX}/etc/periodic/security
install -d ${DESTDIR}${PREFIX}/etc/periodic/daily
.for periodic in ${SCRIPTS_DAILY:R}
install -m 555 ${.OBJDIR}/${periodic} ${DESTDIR}${PREFIX}/etc/periodic/daily
install -m 555 ${periodic} ${DESTDIR}${PREFIX}/etc/periodic/daily
.endfor
.for periodic in ${SCRIPTS_SECURITY:R}
install -m 555 ${.OBJDIR}/${periodic} ${DESTDIR}${PREFIX}/etc/periodic/security
install -m 555 ${periodic} ${DESTDIR}${PREFIX}/etc/periodic/security
.endfor

.include <bsd.own.mk>
.include <bsd.prog.mk>
15 changes: 4 additions & 11 deletions scripts/sbin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,12 @@

PREFIX?= /usr/local

SRCS= pkg2ng.in
SCRIPTS= ${SRCS:R}
SCRIPTS= pkg2ng
CLEANFILES= ${SCRIPTS}
BINDIR= ${PREFIX}/sbin

.in:
sed -e 's,__PREFIX__,${PREFIX},g' \
${.IMPSRC} > ${.TARGET}

all: ${SCRIPTS}

clean:
rm -f ${.OBJDIR}/${SCRIPTS}

install: all
install -m 555 ${.OBJDIR}/pkg2ng ${DESTDIR}${PREFIX}/sbin/

.include <bsd.own.mk>
.include <bsd.prog.mk>

0 comments on commit fd092c7

Please sign in to comment.