Skip to content

Commit

Permalink
Support out-of-tree builds
Browse files Browse the repository at this point in the history
- Loads of VPATHs and new include flags.

- We need to make some directories in the build directory; do this in auto.def

- Some occasional confusion between the build directory and the source
  directory for particular files' locations.

- Fix the invocations of gzip in docs so that they actually write their
  compressed contents over stdout as looks to have been expected.
  • Loading branch information
nwf-msr authored and bapt committed Jun 30, 2022
1 parent 153b13b commit fbaaacc
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 7 deletions.
1 change: 1 addition & 0 deletions auto.def
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,4 @@ foreach dir [list external/blake2 external/picosat \
make-template $dir/Makefile.autosetup $dir/Makefile
}

file mkdir external/libucl/src scripts/periodic scripts/completion
5 changes: 4 additions & 1 deletion compat/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ SRCS= closefrom.c \
funopen.c

LOCAL_CFLAGS= -I$(top_srcdir)/compat \
-I$(top_srcdir)
-I$(top_srcdir) \
-I$(top_builddir)

VPATH= $(top_srcdir)/compat

include $(MK)/static-lib.mk

8 changes: 5 additions & 3 deletions docs/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,20 @@ MAN3GZ= $(MAN3:.3=.3.gz)
MAN5GZ= $(MAN5:.5=.5.gz)
MAN8GZ= $(MAN8:.8=.8.gz)

VPATH= $(top_srcdir)/docs

.SUFFIXES: .3.gz .5.gz .8.gz .3 .5 .8

all: $(MAN3GZ) $(MAN5GZ) $(MAN8GZ)

.3.3.gz:
gzip -kfn $< > $@
gzip -knc $< > $@

.5.5.gz:
gzip -kfn $< > $@
gzip -knc $< > $@

.8.8.gz:
gzip -kfn $< > $@
gzip -knc $< > $@

clean:
rm -f *.gz
Expand Down
2 changes: 2 additions & 0 deletions external/blake2/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ LIB= blake2
SRCS= blake2b-ref.c blake2s-ref.c
LOCAL_CFLAGS= -I$(top_srcdir)/compat -O3

VPATH= $(top_srcdir)/external/blake2

include $(MK)/static-lib.mk
3 changes: 3 additions & 0 deletions external/libfetch/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ SRCS= common.c \

LOCAL_CFLAGS= -I$(top_srcdir)/compat \
-I$(top_srcdir) \
-I$(top_builddir) \
-Wno-unused-parameter \
-Wno-pointer-sign \
-DWITH_SSL \
-DINET6

VPATH= $(top_srcdir)/external/libfetch

include $(MK)/static-lib.mk
2 changes: 2 additions & 0 deletions external/libucl/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ LOCAL_CFLAGS= -I$(top_srcdir)/external/libucl/include \
-Wno-unused-parameter \
-Wno-pointer-sign

VPATH= $(top_srcdir)/external/libucl

include $(MK)/static-lib.mk
1 change: 1 addition & 0 deletions external/linenoise/Makefile.autosetup
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include @builddir@/mk/defs.mk
LIB= linenoise
SRCS= linenoise.c
VPATH= $(top_srcdir)/external/linenoise

include $(MK)/static-lib.mk
2 changes: 2 additions & 0 deletions external/msgpuck/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ LIB= msgpuck
SRCS= msgpuck.c \
hints.c

VPATH= $(top_srcdir)/external/msgpuck

include $(MK)/static-lib.mk

3 changes: 3 additions & 0 deletions external/picosat/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ SRCS= picosat.c \
version.c
LOCAL_CFLAGS= -Wno-strict-aliasing \
-Wno-unused -DNGETRUSAGE

VPATH= $(top_srcdir)/external/picosat

include $(MK)/static-lib.mk
3 changes: 3 additions & 0 deletions external/sqlite/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SRCS= sqlite3.c \
shell.c

LOCAL_CFLAGS= -I$(top_srcdir)/external/linenoise \
-I$(top_builddir)/external/sqlite \
-D_HAVE_SQLITE_CONFIG_H \
-DHAVE_LINENOISE \
-Wno-unused-variable \
Expand Down Expand Up @@ -39,4 +40,6 @@ LOCAL_CFLAGS= -I$(top_srcdir)/external/linenoise \
-Dmain=sqlite3_shell \
-DNDEBUG

VPATH= $(top_srcdir)/external/sqlite

include $(MK)/static-lib.mk
4 changes: 3 additions & 1 deletion external/yxml/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ LIB= yxml

SRCS= yxml.c

LOCAL_CFLAGS= -Wno-unused-parameter -I.
LOCAL_CFLAGS= -Wno-unused-parameter -I. -I$(top_srcdir)/external/yxml

VPATH= $(top_srcdir)/external/yxml

include $(MK)/static-lib.mk

Expand Down
7 changes: 6 additions & 1 deletion libpkg/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ LOCAL_CFLAGS= -I$(top_srcdir)/compat \
-I$(top_srcdir)/external/liblua/ \
-I$(top_srcdir)/external/msgpuck \
-I$(top_srcdir)/libpkg/repo \
-I$(top_builddir)/libpkg/repo \
-I$(top_srcdir)/libpkg \
-I$(top_builddir)/libpkg \
-I$(top_srcdir) \
-I$(top_builddir) \
-Wno-pointer-sign \
-Wno-missing-field-initializers \
-Wno-sign-compare \
Expand Down Expand Up @@ -122,7 +125,7 @@ LOCAL_LDFLAGS+= -L$(top_builddir)/external/libmachista -lmachista_pic \
SRCS+= pkg_macho.c
@else
SRCS+= pkg_elf.c
LOCAL_LDFLAGS+= -Wl,--version-script=$(top_builddir)/libpkg/libpkg.ver \
LOCAL_LDFLAGS+= -Wl,--version-script=$(top_srcdir)/libpkg/libpkg.ver \
@endif

@if libelf-internal
Expand All @@ -147,6 +150,8 @@ LOCAL_CFLAGS+= @PKG_LIBLDNS_CFLAGS@
LOCAL_LDFLAGS+= @PKG_LIBLDNS_LDFLAGS@ @PKG_LIBLDNS_LIBS@
@endif

VPATH= $(top_srcdir)/libpkg

include $(MK)/lib.mk

$(OBJS) $(SHOBJS): $(top_builddir)/pkg_config.h
Expand Down
4 changes: 4 additions & 0 deletions libpkg/repo/binary/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ SRCS= binary.c \
query.c \
update.c
LOCAL_CFLAGS= -I$(top_srcdir)/libpkg \
-I$(top_builddir)/libpkg \
-I$(top_srcdir)/external/uthash \
-I$(top_srcdir)/external/sqlite \
-I$(top_srcdir)/external/libucl/include \
-I$(top_srcdir)/external/include \
-I$(top_srcdir)/compat \
-I$(top_srcdir)/ \
-I$(top_builddir)/

VPATH= $(top_srcdir)/libpkg/repo/binary

include $(MK)/static-lib.mk
2 changes: 2 additions & 0 deletions scripts/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ PWEEKLY= periodic/400.status-pkg
COMPLETION= completion/_pkg \
completion/_pkg.bash

VPATH= $(top_srcdir)/scripts

all: $(PDAILY) $(PSECURITY) $(PWEEKLY) $(COMPLETION)

clean:
Expand Down
4 changes: 3 additions & 1 deletion src/Makefile.autosetup
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ LOCAL_CFLAGS= -I$(top_srcdir)/compat \
-I$(top_srcdir)/external/libucl/include \
-I$(top_srcdir)/external/include \
-I$(top_builddir)/ \
-I$(top_srcdir)/libpkg \
-I$(top_builddir)/libpkg \
-DGITHASH=\"@GITHASH@\" \
-DHAVE_CONFIG_H
Expand Down Expand Up @@ -84,6 +85,7 @@ STATIC_ARG= -static
STATIC_LDFLAGS= $(LIBPKGFLAT) $(LIBS) $(OTHER_LIBS)
@endif

VPATH= $(top_srcdir)/src

include $(MK)/prog.mk

Expand All @@ -106,7 +108,7 @@ $(PROG): $(top_builddir)/libpkg/libpkg_flat.a
install: $(PROG)
install -d -m 755 $(DESTDIR)$(sbindir)
install -m 755 pkg $(DESTDIR)$(sbindir)/pkg
install -m 644 pkg.conf.sample $(DESTDIR)$(etcdir)/
install -m 644 $(top_srcdir)/src/pkg.conf.sample $(DESTDIR)$(etcdir)/

clean: clean-pkg-static
clean-pkg-static:
Expand Down

0 comments on commit fbaaacc

Please sign in to comment.