ports/mk/ports.mk

110 lines
3.3 KiB
Makefile
Raw Normal View History

2022-09-06 23:57:09 -04:00
# ports.mk - hhl - /usr/include/mk
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
portdir = $(shell pwd)
workdir = $(portdir)/work
DESTDIR = $(workdir)/staged
basedir = $(portdir)/../..
include $(basedir)/config.mk
prefix ?= /usr/pkg
confdir ?= $(prefix)/etc
localstatedir ?= $(prefix)/var
logdir ?= $(localstatedir)/log
default_goal ?= all
install_cmd ?= $(MAKE) $(makeflags) DESTDIR=$(DESTDIR) -C $(objdir) install
export PATH = /usr/pkg/bin:/usr/pkg/sbin:/usr/bin:/usr/sbin:/bin:/sbin
ifndef colormk
include $(basedir)/mk/hhl.colors.mk
endif
exec_prefix ?= $(DESTDIR)$(prefix)
bindir ?= $(exec_prefix)/bin
sbindir ?= $(exec_prefix)/sbin
libdir ?= $(DESTDIR)$(install_prefix)/lib
libexecdir ?= $(DESTDIR)$(install_prefix)/libexec
includedir ?= $(DESTDIR)$(install_prefix)/include
sharedir ?= $(DESTDIR)$(install_prefix)/share
docdir ?= $(sharedir)/doc
infodir ?= $(sharedir)/info
localedir ?= $(sharedir)/locale
mandir ?= $(sharedir)/man
man1dir = $(mandir)/man1
man2dir = $(mandir)/man2
man3dir = $(mandir)/man3
man4dir = $(mandir)/man4
man5dir = $(mandir)/man5
man6dir = $(mandir)/man6
man7dir = $(mandir)/man7
man8dir = $(mandir)/man8
distname ?= $(pkg_name)
pkg_rev ?= 1
pkg_ext ?= tgz
pkgfullname ?= $(pkg_name)-$(pkg_version)_hhl$(pkg_rev)
pkgfile ?= $(pkgfullname).$(pkg_ext)
pkglocal ?= $(pkgdir)/$(pkgfile)
pkgdeps = $(workdir)/.stripped $(workdir)/PLIST $(workdir)/BUILD_INFO
distdir = $(basedir)/distfiles
distfullname ?= $(distname)-$(pkg_version)
distext ?= xz
distfile ?= $(distfullname).tar.$(distext)
distlocal ?= $(distdir)/$(distfile)
pkgdir = $(basedir)/packages
srcdir = $(workdir)/$(distfullname)
objdir = $(workdir)/build
installdirs += $(distdir)
installdirs += $(pkgdir)
installdirs += $(workdir)
installdirs += $(srcdir)
installdirs += $(objdir)
installdirs += $(DESTDIR)
#LDFLAGS += -Wl,-R/usr/lib64
#LDFLAGS += -Wl,R/usr/pkg/lib
#export LDFLAGS
export LC_ALL = POSIX
use_configure ?= 1
no_objdir ?= 0
ifeq ($(use_configure),1)
config_tgt ?= $(objdir)/Makefile
config_deps += $(srcdir)/.dirstamp
config_opts ?= --prefix=$(prefix)
config_cmd ?= cd $(objdir) && $(srcdir)/configure $(config_opts)
build_deps ?= $(config_tgt)
else
build_deps ?= $(config_deps)
build_deps += $(srcdir)/.dirstamp
endif
build_cmd ?= $(MAKE) $(makeflags) -C $(objdir)
install_deps ?= $(portdir)/work/.built
install_cmd ?= $(MAKE) $(makeflags) -C $(objdir) install
all_deps ?= $(portdir)/work/.built
ifeq ($(no_objdir),1)
objdir = $(srcdir)
else
pre_dirs += $(objdir)
endif
ifdef patches
config_deps += $(patches) $(srcdir)/.patched
endif
.DEFAULT_GOAL = $(default_goal)
# Some common remote locations
gnu = https://ftp.gnu.org/gnu
savannah = https://download.savannah.gnu.org/releases
github = https://github.com
sourceforge = https://downloads.sourceforge.net/project
kernel = https://www.kernel.org/pub/linux
ifeq (gnu,$(remote_site))
dist_remote = $(gnu)/$(distname)/$(distfullname)/$(distfile)
endif