The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: Larry McVoy <lm@mcvoy.com>
To: Nevin Liber <nliber@gmail.com>
Cc: The Eunuchs Hysterical Society <tuhs@tuhs.org>
Subject: [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' The Register
Date: Wed, 19 Jun 2024 06:28:46 -0700	[thread overview]
Message-ID: <20240619132846.GR32048@mcvoy.com> (raw)
In-Reply-To: <CAGg_6+P8h+czyXx0uxPDSJKUtWsMjsbD6ZGwJtHDbmiFvgxFTw@mail.gmail.com>

On Tue, Jun 18, 2024 at 07:46:15PM -0500, Nevin Liber wrote:
> But I'll bite.  There was the claim by Larry McVoy that "Writing Makefiles
> isn't that hard".
> 
> Please show these beautiful makefiles for a non-toy non-trivial product

Works on *BSD, MacOS, Windows, Linux on a bunch of different architectures,
Solaris, HPUX, AIX, IRIX, Tru64, etc.

# Copyright 1999-2016 BitMover, Inc

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Makefile for BitKeeper.

# Bitmover makefiles try to provide the following targets:
#
# all		build everything under the current directory
#
# clean		remove all objects and programs
#
# clobber	run clean plus 'bk -r. clean'
#
# srcs		bk get all sources in current directory
#
# tags		build ctags for all srcs (only needed in this (top) makefile)
#
# tags.local	build ctags for srcs under current directory relative to top
#
#---
# Special make variables commonly used this makefile:
#   $@	target
#   $^  all sources
#   $<  first source

INSTALLED_BK	?= $(shell bash -c "cd / && command -v bk")
INREPO  ?= $(shell bash -c "test -d ../.bk && echo true || echo false")
HERE    := $(shell pwd)
ROOT	:= $(shell dirname $(HERE))
REPO    := $(notdir $(ROOT))
URL     := $(shell echo bk://work/$(ROOT) | sed s,/home/bk/,,)
LOG	= $(shell echo LOG-`bk getuser`)
OSTYPE  := $(shell bash -c 'echo $$OSTYPE')

include conf.mk

## Which hosts are used for producing nightly builds
NIGHTLY_HOSTS	:= macos106 win7-vm debian40 debian40-64

ifeq "$(OSTYPE)" "msys"
	SYS=win32
	EXE=.exe
	XTRA=win32
	ifeq (,$(INSTALLED_BK))
		# BINDIR should really be :C:/Program Files/BitKeeper
		# The shell can not handle space in pathname, so
		# we use the short name here
		BINDIR := "C:/PROGRA~1/BITKEE~1"
	else
		BINDIR := $(shell bk pwd -s "`bk _registry get 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion' ProgramFilesDir`/BitKeeper")
	endif
	INSTALL=installdir
	RESOURCE=bkres.o
	UWT_C=$(patsubst %,win32/uwtlib/%.c, wapi_intf wcrt_intf)
	BKGUI=bkg$(EXE)
	BKG_O=bkg.o
else
	SYS=unix
	EXE=
	# You can set this to anywhere you like and do a 
	# build production" and you'll have an installed BitKeeper.
	ifeq (,$(INSTALLED_BK))
		BINDIR := /usr/local/bitkeeper
	else
		BINDIR := $(shell "$(INSTALLED_BK)" bin)
	endif
	INSTALL=install
	RESOURCE=
endif

# By default, we don't print verbose output. If you want to see
# the full compiler command line, use 'make V=1'
# The trick is to do "$(Q)$(CC)" instead of just "$(CC)" so that if
# Q is not set, it's just "$(CC)" and if Q is set to @ it becomes
# a quiet "@$(CC)".
# For the verbose messages, gmake provides
# $(if $(Q),<then>,<else>)
# so we just conditionalize on Q. Empty is false.
ifndef V
	Q=@
	export Q
endif

BK=./bk$(EXE)
G	=-g
TRIAL	=0
IMGDIR	=$(HERE)/tmp/bitkeeper

# Handle warning arguments in GCC
#
# -Wall enables a bunch of warnings by default
# -Wno-parentheses shuts up "suggest parentheses around assignment ...".
#  Unfortunately it also turns off dangling else warnings.
# -Wno-char-subscripts shuts up "subscript has type char", which comes
#  up all the time with broken <ctype.h> implementations.  
#  (renabled in GCC3 since it supresses warnings in system files by default)
# -Wno-format-y2k supresses complains about '%y' in strftime formats
# -Wstrict-prototypes    Don't allow non-ansi function declarations
WARNINGS=-Wall -Wno-parentheses -Wno-char-subscripts -Wno-format-y2k \
	-Wstrict-prototypes

# Warnings enabled with GCC newer than 3.0
#
# -Wredundant-decls	  Declaring same function twice
# -Wmissing-declarations  Functions without a prototype
WARNINGS_GCC3=-Wchar-subscripts -Wredundant-decls -Wmissing-declarations

# Warnings enabled with GCC newer than 4.0
#
# -Wextra  enable a bunch of random things (called -Wextra in newer gccs)
# -Wno-pointer-sign  Suppress warnings about changing the signs of pointers
# -Wno-sign-compare  Suppress warnings about comparing signed and unsigned vars
# -Wno-unsed-parameter Support warnings about function parameters that are 
#  no used
# -Wno-missing-field-initializers
# -Wdeclaration-after-statement Warn if someone does a C++ thing of declaring
#  a variable in the middle of a block
WARNINGS_GCC4=-Wextra -Wno-pointer-sign -Wno-sign-compare \
	-Wno-unused-parameter -Wno-missing-field-initializers \
	-Wdeclaration-after-statement -Wpointer-arith

# Warnings enabled with GCC newer than 5.0
#
# -Wno-unusedr-esult Do not warn if a caller ignores return value
WARNINGS_GCC5=-Wno-unused-result

WARNINGS_GCC6= -Wno-misleading-indentation

# XXX could not get -Wimplicit-fallthrough=3 to work
WARNINGS_GCC7= -Wno-implicit-fallthrough

# Other options to consider enabling in the future:
#
# -Wnested-externs Prototypes declared in a function
# -Wwrite-string warn in string constant is passed to a char *
# -Wmissing-prototypes
# -Wunused-parameter
# -Wold-style-definition Would be nice, but zlib falls all over here

GCC_MAJOR_REV=$(shell $(CC) -dumpversion | sed 's/\..*//')
GCC_MINOR_REV=$(shell $(CC) -dumpversion | sed 's/.*\.//')
ifeq ($(GCC_MAJOR_REV),3)
	WARNINGS += $(WARNINGS_GCC3)
endif
ifeq ($(GCC_MAJOR_REV),4)
	WARNINGS += $(WARNINGS_GCC3) $(WARNINGS_GCC4)
	ifeq ($(shell expr $(GCC_MINOR_REV) \> 5), 1)
		WARNINGS += -Wno-unused-result
	endif
endif
ifeq ($(GCC_MAJOR_REV),5)
	WARNINGS += $(WARNINGS_GCC3) $(WARNINGS_GCC4) $(WARNINGS_GCC5)
endif
ifeq ($(GCC_MAJOR_REV),6)
	WARNINGS += $(WARNINGS_GCC3) $(WARNINGS_GCC4) $(WARNINGS_GCC5) \
		    $(WARNINGS_GCC6)
endif
ifeq ($(GCC_MAJOR_REV),7)
	WARNINGS += $(WARNINGS_GCC3) $(WARNINGS_GCC4) $(WARNINGS_GCC5) \
		    $(WARNINGS_GCC6) $(WARNINGS_GCC7)
endif
ifeq ($(GCC_MAJOR_REV),8)
	WARNINGS += $(WARNINGS_GCC3) $(WARNINGS_GCC4) $(WARNINGS_GCC5) \
		    $(WARNINGS_GCC6) $(WARNINGS_GCC7) $(WARNINGS_GCC8)
endif

TRACE = -DUSE_TRACE

ifeq ($(shell uname -s), Darwin)
	XLIBS += -lresolv
	G	+= -DNOPROC
endif

ifeq (clang, $(findstring clang, $(shell $(CC) --version)))
	WARNINGS += -Wno-unused-value -Wno-empty-body -Wno-self-assign
endif

GCCOPTS=
CC_DEBUG=$(GCCOPTS) $G $(WARNINGS) $(TRACE)
CC_FAST_DEBUG=$(GCCOPTS) $G -O2 $(WARNINGS) $(TRACE)
CC_FAST	=$(CC_FAST_DEBUG)
CC_WALL=$(GCCOPTS) $G -DLINT $(WARNINGS) $(TRACE)
BINS	= $(BK) $(BKGUI)

# List of all objects in bk other than bk.o. Keep it sorted.
# But put bkver.o/cmd.o first, they generate headers.
OBJ =	bkver.o cmd.o \
	abort.o adler32.o alias.o admin.o annotate.o attributes.o \
	bam.o bisect.o bkd.o bkd_bam.o bkd_cd.o \
	bkd_changes.o bkd_client.o bkd_clone.o bkd_cmdtab.o \
	bkd_findkey.o bkd_http.o \
	bkd_id.o bkd_kill.o bkd_level.o bkd_misc.o bkd_nested.o \
	bkd_partition.o bkd_pull.o bkd_push.o bkd_pwd.o \
	bkd_r2c.o \
	bkd_rclone.o bkd_rootkey.o bkd_status.o bkd_synckeys.o bkd_version.o \
	bkverinfo.o \
	cat.o cfile.o changes.o config.o \
	check.o checksum.o clean.o cleanpath.o clone.o \
	cmdlog.o \
	collapse.o comment.o comments.o commit.o comps.o compress.o \
	contrib/cat.o \
	contrib/test.o \
	converge.o \
	cp.o \
	crypto.o \
	cset.o cset_inex.o csetprune.o csets.o cweave.o \
	dataheap.o dbfile.o delta.o diff.o dspec.o \
	export.o \
	fast-import.o fast-export.o features.o findmerge.o \
	find.o findcset.o fixtool.o fsl.o fslayer.o \
	g2bk.o gca.o get.o gethelp.o \
	gethost.o gettemp.o getuser.o gfiles.o glob.o \
	gnupatch.o graft.o grep.o \
	hash_nokey.o \
	heapdump.o help.o here.o here_check.o hostme.o http.o \
	idcache.o isascii.o info.o \
	key2rev.o key2path.o kill.o kv.o \
	libcommit.o libdiff.o libgraph.o librange.o \
	libsfiles.o lines.o \
	localtm.o lock.o locking.o \
	mail.o merge.o mklock.o \
	mailslot.o \
	mtime.o mv.o names.o ndiff.o nested.o newroot.o \
	opark.o \
	parent.o park.o partition.o \
	patch.o \
	pending.o preference.o proj.o \
	poly.o \
	populate.o \
	port/bkd_server.o \
	port/check_rsh.o \
	port/gethomedir.o \
	port/gethost.o port/getinput.o \
	port/getrealname.o port/getrusage.o port/globalroot.o port/gui.o \
	port/hostColonPath.o port/http_proxy.o \
	port/mail.o port/mnext.o port/networkfs.o \
	port/notifier.o port/ns_sock_host2ip.o port/platforminit.o \
	port/sccs_getuser.o port/sccs_lockfile.o \
	port/startmenu.o \
	port/svcinfo.o \
	port/uninstall.o \
	progress.o \
	prs.o pull.o push.o pwd.o \
	randombits.o randseed.o range.o rcheck.o rclone.o \
	rcs2bk.o rcsparse.o \
	receive.o redblack.o regex.o registry.o renumber.o \
	remap.o	remote.o \
	repo.o repos.o repogca.o repostats.o repotype.o \
	resolve.o resolve_binaries.o resolve_contents.o \
	resolve_create.o resolve_filetypes.o \
	resolve_flags.o resolve_generic.o resolve_modes.o \
	resolve_renames.o resolve_tags.o restore.o review.o \
	rm.o rmdel.o rmgone.o \
	root.o rset.o sane.o scat.o sccs.o sccs2bk.o \
	sccslog.o sccs_mv.o search.o sec2hms.o send.o sendbug.o \
	set.o setup.o sfio.o shrink.o sinfo.o \
	slib.o smerge.o sort.o startmenu.o \
	stat.o stattest.o status.o stripdel.o synckeys.o \
	tagmerge.o testcode.o tclsh.o takepatch.o \
	testdates.o time.o timestamp.o touch.o trigger.o \
	unbk.o undo.o undos.o unedit.o \
	unique.o uninstall.o unlink.o unlock.o unpull.o unrm.o unwrap.o upgrade.o \
	urlinfo.o \
	utils.o uu.o what.o which.o \
	xfile.o xflags.o \
	zone.o
SCRIPTS	= bk.script import \
	uuwrap unuuwrap gzip_uuwrap ungzip_uuwrap \
	b64wrap unb64wrap gzip_b64wrap ungzip_b64wrap
PSCR	= t/doit t/guitest
PROGS	= libc/mtst$(EXE)
LIBS	= libc/libc.a
DATA	= bkmsg.txt bkhelp.txt version \
	../doc/bk_refcard.ps ../doc/bk_refcard.pdf ../RELEASE-NOTES.md \
	dspec-changes dspec-changes-3.2 dspec-changes-4.0 dspec-changes-h \
	dspec-changes-hv dspec-changes-json dspec-changes-json-v \
	dspec-changes-vv dspec-log dspec-prs

CONTRIB = gui/ide/emacs/vc-bk.el contrib/git2bk.l
ALL	= PCRE $(LIBS) $(BINS) $(SCRIPTS) $(PSCR) $(XTRA) \
	$(PROGS) L-clean GUI L-doc $(DATA)

CFLAGS	= $(CC_DEBUG)
export CFLAGS
CPPFLAGS= -Ilibc $(TOMCRYPT_CPPFLAGS) $(TOMMATH_CPPFLAGS) \
	$(PCRE_CPPFLAGS) $(LZ4_CPPFLAGS) $(ZLIB_CPPFLAGS)
# Override this if you don't have it.
RANLIB	= ranlib

# list of C sources in bk
SRCS	= bk.c $(OBJ:.o=.c)
# list of headers in bk
HDRS	= bam.h bkd.h bk-features.h config.h configvars.def diff.h fsfuncs.h \
	  graph.h nested.h \
	  progress.h range.h rcs.h resolve.h sccs.h \
	  cmd.h poly.h proj.h redblack.h libc/system.h xfile.h

# list of non-C sources in bk
SCRSRCS	= bk.sh import.sh kwextract.pl uuwrap.sh unuuwrap.sh \
	  port/unix_platform.sh port/win32_platform.sh \
	  gzip_uuwrap.sh ungzip_uuwrap.sh \
	  substvars.sh b64wrap.sh gzip_b64wrap.sh \
	  unb64wrap.sh ungzip_b64wrap.sh 
MISC	= bkmsg.doc t/doit.sh

default:
	$(MAKE) p

SUBDIRS = libc $(shell ls -d tomcrypt tommath 2>/dev/null)

all: $(ALL)

prof:
	$(MAKE) CFLAGS="$G -pg -O2" LDFLAGS=-pg all
gprof:
	$(MAKE) CFLAGS="$G -DPROFILE -pg -O2" LDFLAGS=-pg all
ggprof:
	$(MAKE) CFLAGS="$G -DPROFILE -pg" LDFLAGS=-pg all
# Debugging...
d:
	$(MAKE) CFLAGS="$G -DDEBUG" all
debug:
	$(MAKE) CFLAGS="$G -DDEBUG" all
debug2:
	$(MAKE) CFLAGS="$G -DDEBUG2" all

gWall Wall:
	$(MAKE) CFLAGS="$(CC_WALL)" all

# production builds
p:  ## Build a production version of BitKeeper (no -g)
	$(MAKE) CFLAGS="$(CC_FAST) $(CF)" all

trial:
	$(MAKE) TRIAL="3*WEEK" CFLAGS="$(CC_FAST) $(CF)" all

trial3M:
	$(MAKE) TRIAL="3*MONTH" CFLAGS="$(CC_FAST) $(CF)" all

g:  ## Build a debug version of BitKeeper (-g)
	$(MAKE) CFLAGS="$(CC_DEBUG)" all
gO:
	$(MAKE) CFLAGS="$(CC_FAST_DEBUG)" all
gcov:
	$(MAKE) CFLAGS="$(CC_DEBUG) -fprofile-arcs -ftest-coverage" all

clean: L-clean FORCE  ## Remove object files and executables
	$(if $(Q),@echo Cleaning up,)
	$(Q)for sub in $(SUBDIRS) ../doc ../man gui utils win32 t t/win32; \
	do	$(MAKE) -C$$sub "CFLAGS=$(CFLAGS)" $@; \
	done
	$(Q)$(RM) $(OBJ) bk.o $(BKG_O) $(BINS) $(SCRIPTS) \
	    $(PSRC) $(PROGS)
	$(Q)$(RM) tags TAGS tags.local cscope.out substvars a.out cmd.c cmd.h \
		core *.bb *.bbg *.da *.gcov \
		bk.ico \
		bkmsg.txt bkhelp.txt bkver.c version \
		t/doit t/guitest kw2val_lookup.c bkres.o svcmgr.exe \
		conf.mk
	$(Q)$(RM) -r tmp
ifeq "$(OSTYPE)" "msys"
	$(Q)$(RM) -rf gnu/bin gnu/doc gnu/etc gnu/share
	$(Q)$(RM) -f gnu/m.ico gnu/msys.bat gnu/msys.ico
	$(Q)-rmdir gnu/tmp
	$(Q)-rmdir gnu
endif
ifeq (true,$(INREPO))
ifneq (,$(INSTALLED_BK))
	$(Q)EXTRALIST=`"$(INSTALLED_BK)" -Aax | \
		grep -v '~$$\|conf-.*\.mk$$'` ; \
	if [ "$$EXTRALIST" ]; then \
		echo "Clean left behind the following files:" ; \
		for file in $$EXTRALIST; do \
			echo "  $$file" ; \
		done ; \
	else \
		echo Clean complete ; \
	fi
endif
endif

clobber: clean FORCE ## Same as 'clean' but also bk clean files
	-@$(BK) -A clean

# XXX subdirs? (see tags)
wc: $(HDRS) $(SRCS) $(SCRSRCS) $(MISC)
	wc -l $(SRCS) $(HDRS) $(SCRSRCS) $(MISC)

get-e: FORCE
	-@$(BK) edit -qT `echo $(HDRS) $(SRCS) $(SCRSRCS) $(MISC) | fmt -1|sort -u`
	$(Q)$(MAKE) tags

srcs: $(SRCS) $(HDRS) FORCE
	$(Q)for sub in $(SUBDIRS); do $(BK) -r$$sub co -q; done

tags: $(patsubst %,%/tags.local, $(SUBDIRS)) tags.local
	@if [ -x $(BK) ]; \
	then	$(BK) get -Sq tags.skippats; \
		$(BK) _sort -u $^ | grep -v -ftags.skippats > $@; \
	else \
		bk get -Sq tags.skippats; \
		bk _sort -u $^ | grep -v -ftags.skippats > $@; \
	fi
	@echo ctags completed

tags.local: $(SRCS) $(HDRS)
	@ctags -f $@ --file-tags=yes --c-types=d+f+s+t $^

%/tags.local: FORCE
	$(Q)$(MAKE) -C $(dir $@) tags.local

ssh sshtest:
	$(MAKE) realtest

rsh rshtest:
	PREFER_RSH=YES $(MAKE) realtest

test tests:
	DO_REMOTE=NO $(MAKE) -C t

nonet nonet_test localtest:
	BK_NONET=YES PREFER_RSH=YES $(MAKE) realtest

realtest: $(ALL) t/doit
	-cd gui/tcltk && $(MAKE) clobber
	-$(BK) get -qS t/setup t/win32/win32_common
	$(BK) -rt get -qTS 't.*'
	cd t && ./doit -f 5

guitest: $(ALL) t/doit
	-$(BK) get -qS t/SCCS/s.g.* t/setup t/win32/win32_common t/guitest.tcl
	cd t && ./doit -g -i

t/doit: t/doit.sh substvars
	./substvars t/doit.sh > t/doit
	chmod +x t/doit

t/guitest: t/guitest.tcl
	cat < t/guitest.tcl > t/guitest

.PHONY: FORCE
FORCE:

win32: FORCE
	cd win32 && $(MAKE) BINDIR=$(BINDIR)
	cd t/win32 && $(MAKE)

# build libraries in sub directories
%.a: FORCE
	$(Q)$(MAKE) -C $(dir $@) $(notdir $@)

libc/mtst$(EXE): libc/libc.a FORCE
	$(Q)$(MAKE) -C libc mtst$(EXE)

bkres.o: win32/data/bk.rc bk.ico
	windres -i win32/data/bk.rc -o bkres.o

bk.ico: win32/data/bk.ico
	@cp -f win32/data/bk.ico .

ifneq ($(TOMCRYPT_SYSTEM),1)
# add dependency on building libraries first
$(BK): $(TOMCRYPT_LDFLAGS)
endif
ifneq ($(TOMMATH_SYSTEM),1)
# add dependency on building libraries first
$(BK): $(TOMMATH_LDFLAGS)
endif

$(BK): $(LIBS) bk.o $(RESOURCE) $(OBJ)
	$(if $(Q),@echo LINKING $(BK),)
	$(Q)$(LD) $(LDFLAGS) -o $@ bk.o $(OBJ) $(RESOURCE) $(LIBS) \
		$(TOMCRYPT_LDFLAGS) $(TOMMATH_LDFLAGS) \
		$(PCRE_LDFLAGS) $(LZ4_LDFLAGS) $(ZLIB_LDFLAGS) $(XLIBS)

# Windows only rule, BKGUI should be blank on other platforms
$(BKGUI): bkg.o $(RESOURCE)
	$(if $(Q),@echo LINKING $(BKGUI),)
	$(Q)$(LD) $(LDFLAGS) -o $@ bkg.o $(RESOURCE) -Llibc -lc -mwindows $(XLIBS)

bk.script: bk.sh port/$(SYS)_platform.sh
	cat port/$(SYS)_platform.sh bk.sh > bk.script
	chmod +x bk.script 

bkmsg.txt: bkmsg.doc
	cp -f $< $@

L-clean: FORCE
	@rm -f gui/share/doc/L/little.man ../man/man1/bk-little.1
	@rm -f ../man/man2help/bk-little-1.fmt

# has to run before bkhelp.txt but after GUI
L-doc L-docs: GUI FORCE
	@test -f gui/share/doc/L/little.man || { \
		echo Failed to build gui/share/doc/L/little.man; \
		exit 1; \
	}
	@if [ -s gui/share/doc/L/little.man ]; \
	then	cp gui/share/doc/L/little.man ../man/man1/bk-little.1; \
	else	cp ../man/man1/bk-little.1.pfmt ../man/man1/bk-little.1; \
	fi; \
	chmod +w ../man/man1/bk-little.1

bkhelp.txt: $(BK) version L-docs FORCE
	@rm -f ../man/man2help/bk-little.fmt
	@cd ../man/man2help && $(MAKE) BK=$(HERE)/bk$(EXE) helptxt
	@cp ../man/man2help/helptxt bkhelp.txt
	@rm -f ../man/man1/bk-little.1

html-docs: bkhelp.txt
	@cd ../man/man2html && $(MAKE)

../doc/bk_refcard.ps: $(BK) FORCE
	$(Q)echo building $@
	$(Q)-$(BK) -r../doc co -qS
	$(Q)$(MAKE) -C ../doc BK=$(HERE)/bk$(EXE) all

../doc/bk_refcard.pdf: ../doc/bk_refcard.ps

# This must be rebuilt every time because it includes the build time
bkver.c: utils/bk_version FORCE
	$(if $(Q),@echo Building $@,)
	$(Q)echo "#include \"sccs.h\"" > bk.v
	$(Q)echo "char *bk_platform = \""`./utils/bk_version`"\";" >> bk.v
	$(Q)echo "int test_release = "$(TRIAL)";" >> bk.v
	$(Q)echo "time_t bk_build_timet = "`perl -e "print time"`";" >> bk.v
	$(Q)echo "char *bk_build_dir = \""`pwd`"\";" >> bk.v
	$(Q)mv -f bk.v bkver.c

version: version.sh $(BK) utils/bk_version GUI FORCE
	bash version.sh > $@

%: %.sh
	$(if $(Q),@echo Building $@,)
	$(Q)$(RM) $@
	$(Q)cp $< $@
	$(Q)chmod +x $@

%: %.l
	$(if $(Q),@echo Not lexing $@,)

import: import.sh port/$(SYS)_platform.sh
	cat port/$(SYS)_platform.sh import.sh > import.T
	chmod +x import.T
	mv -f import.T import

# Quick and dirty target so we can make all the gui tools without the rest
.PHONY: GUI
GUI: PCRE $(BK)
	@$(MAKE) -Cgui BK=$(HERE)/bk$(EXE) gui

install: installdir
	tmp/bitkeeper/bk _install -d -f $(DESTDIR)$(BINDIR)
	@echo BitKeeper is installed in $(BINDIR)
	@echo We suggest you run:
	@echo
	@echo sudo $(BINDIR)/bk links /usr/local/bin
	@echo
	@echo to create the bk symlink.

installdir: utils/registry.tcl
	rm -rf $(IMGDIR) || exit 1
	mkdir -p $(IMGDIR)/contrib
	mkdir -p $(IMGDIR)/lscripts
	-$(BK) -rwww get -S
	-cp -f -r www $(IMGDIR)
	-$(BK) get -S $(CONTRIB)
	tar cf - $(BINS) $(SCRIPTS) lscripts gui/bin gui/lib gui/images \
		| (cd $(IMGDIR) && tar xf -)
	cp -f $(DATA) $(IMGDIR)
	cp -f $(CONTRIB) $(IMGDIR)/contrib
	(cd ../doc/nested && $(MAKE) install HTML=$(IMGDIR)/html)
	if [ $(SYS) = unix ]; \
	then	$(BK) get -S ../man/Makefile; \
		cd ../man && $(MAKE) install BINDIR=$(IMGDIR) ;\
	else \
		(cd win32 && $(MAKE) BINDIR=$(IMGDIR) install); \
		cp utils/registry.tcl $(IMGDIR)/gui/lib; \
	fi
	cd $(IMGDIR); \
	    find . -type l | \
		perl -ne 'chomp; $$a = readlink; print "$$a|$$_\n";'>symlinks; \
	    test -s symlinks || rm -f symlinks
	@true

image:  ## Build the installer (left in src/utils/bk-*)
	$(MAKE) p
	$(MAKE) _image

_image:
	$(MAKE) installdir
	${MAKE} -Cutils BINDIR=$(IMGDIR) "CC=$(CC)" "BK=$(HERE)/bk$(EXE)" "CFLAGS=$(CFLAGS)" image

crankturn: crank.sh remote.sh  ## Run a clean-build + regressions in cluster
	REPO=$(REPO) URL=$(URL) REMOTE=remote.sh LOG=$(LOG) bash crank.sh

cranksave: crank.sh remote.sh  ## Run a crankturn but save the built images
	REPO=$(REPO) URL=$(URL) REMOTE=remote.sh LOG=$(LOG) bash crank.sh save

crankstatus: crank.sh remote.sh  ## See how the crank is going
	REPO=$(REPO) URL=$(URL) REMOTE=remote.sh LOG=$(LOG) bash crank.sh status

crankrelease nightly: $(BK) crank.sh remote.sh  ## Do a BitKeeper release (or nightly build)
	@(TAG=$(shell $(BK) changes -r+ -d:TAG:) ; \
	test x$$TAG = x && { \
		echo Cannot crankrelease with a non-tagged tip ; \
		exit 1 ; \
	} ; \
	case $@ in \
	crankrelease ) \
		TYPE=release; DIR=/home/bk/images/$$TAG; \
		;; \
	nightly ) \
		TYPE=nightly; DIR=/home/bk/images/nightly; \
		HOSTS="$(NIGHTLY_HOSTS)" ; \
		;; \
	esac ; \
	test -d $$DIR || mkdir -p $$DIR ; \
	REPO=$(REPO) URL=$(URL) HOSTS=$$HOSTS REMOTE=remote.sh \
	    LOG=$(LOG) bash crank.sh $$TYPE ; \
	$(BK) -R get -qS ../RELEASE-NOTES.md ; \
	cp ../RELEASE-NOTES.md $$DIR ; \
	SAVED_WD=$(shell pwd) ; \
	cd $$DIR && chmod +rx bk-* >/dev/null 2>&1 ; \
	rm -f MD5SUMS ; \
	md5sum bk-* >> MD5SUMS ; \
	echo "Your images are in $$DIR" ; \
	case $@  in  \
	crankrelease ) \
	     	echo "Run './mkrelease $$TAG' to release this version of bk."; \
		;; \
	nightly ) \
#		cd $$SAVED_WD ; \
#		./mkupgrades --nightly $$TAG ; \
		;; \
	esac)

crankclean: crank.sh remote.sh
	REPO=$(REPO) URL=$(URL) REMOTE=remote.sh LOG=$(LOG) bash crank.sh clean

# This target assumes a bk repository
.PHONY: src-tar
src-tar: $(BK) version ## build tar.gz image for the current tree
ifeq (false,$(INREPO))
	$(error This target only works in a BK source repository)
else
	./bk here add default TCLTK
	$(Q)-mkdir -p tmp/src
	$(Q)(DIR=bk-$(shell $(BK) version -s) ; \
	     TAR="$$DIR".tar.gz ; \
	     echo "Creating $$TAR in tmp/src..." ; \
	     cd tmp/src ; \
	     rm -rf "$$DIR" ; \
	     ../../bk export -tplain -kwr+ -sdefault -sTCLTK "$$DIR" ; \
	     cat ../../version > "$$DIR/src/bkvers.txt" ; \
	     tar -czf "$$TAR" "$$DIR" ; \
	     rm -rf "$$DIR" ; \
	     echo Done ; \
	)
endif

# only depend on conf.mk.local if it exists
conf.mk: mkconf.sh $(wildcard conf.mk.local)
	sh mkconf.sh > $@ || { $(RM) $@; false; }

%.o: %.c
	$(if $(Q),@echo CC $<,)
	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@

port/startmenu.o: port/startmenu.c $(HDRS)
	$(if $(Q),@echo CC $<,)
	$(Q)$(CC) $(CFLAGS) -fno-strict-aliasing $(CPPFLAGS) -c $< -o $@

depend: $(SRCS)
	$(CC) -MM -MG -D_DEPEND $(SRCS) > depends

# for system.h we need to actually run libc's makefile because it includes
# calculated header files
libc/system.h: FORCE
	$(MAKE) -C libc system.h

libc/libc.a: libc/system.h

sccs.h: PCRE
.PHONY: PCRE
PCRE:
ifneq ($(PCRE_SYSTEM),1)
	$(MAKE) -Cgui/tcltk pcre
endif

$(OBJ) bk.o: $(HDRS)

cmd.c cmd.h: cmd.pl bk.sh $(filter bkd_%,$(SRCS))
	$(if $(Q),@echo Building $@,)
	$(Q)perl cmd.pl || (rm -f cmd.c cmd.h; exit 1)

# This parses slib.c and extracts the meta-data keywords expanded
# by kw2val() and passes them to gperf to generate hash lookup code.
slib.o:	kw2val_lookup.c
kw2val_lookup.c: slib.c kw2val.pl
	$(if $(Q),@echo Building $@,)
	$(Q)perl kw2val.pl slib.c || (rm -f kw2val_lookup.c; exit 1)

check-syntax:
	$(CC) $(CFLAGS) $(CPPFLAGS) -c -S ${CHK_SOURCES} -o /dev/null

# print a make variable  'make print-REPO'
#   http://www.cmcrossroads.com/article/printing-value-makefile-variable
print-%:
	@echo $* = \"$($*)\"

.PHONY: help

help:
	@grep -E -h '^[-a-zA-Z_\ ]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
	@echo Suggested: make -j12 image


  parent reply	other threads:[~2024-06-19 13:29 UTC|newest]

Thread overview: 174+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 14:56 [TUHS] Version 256 of systemd boasts '42% less Unix philosophy' • " Charles H Sauer (he/him)
2024-06-13 15:33 ` [TUHS] " Dan Cross
2024-06-13 15:35 ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' ??? " Larry McVoy
2024-06-13 15:41   ` Alan D. Salewski
2024-06-13 15:55   ` Steve Nickolas
2024-06-13 15:39 ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' • " Clem Cole
2024-06-13 16:47   ` Arrigo Triulzi via TUHS
2024-06-13 18:39     ` segaloco via TUHS
2024-06-13 18:45       ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' ??? " Mychaela Falconia
2024-06-14  8:59         ` Ralph Corderoy
2024-06-13 18:54       ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' • " Dan Cross
2024-06-12 19:29         ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' " Greg A. Woods
2024-06-13 20:03           ` Dan Cross
2024-06-13 17:07             ` Greg A. Woods
2024-06-14 14:17             ` Grant Taylor via TUHS
2024-06-16  5:48               ` Alexis
2024-06-15  8:48                 ` Greg A. Woods
2024-06-16 19:44                   ` Clem Cole
2024-06-17  0:10                     ` Peter Yardley
2024-06-17  0:29                       ` Clem Cole
2024-06-17  1:01                   ` Alexis
2024-06-17  1:21                     ` Warner Losh
2024-06-17  1:25                     ` Larry McVoy
2024-06-17  1:32                       ` Warner Losh
2024-06-17 19:21                       ` Stuff Received
2024-06-17 19:28                         ` Larry McVoy
2024-06-17 22:34                         ` Steve Nickolas
2024-06-16  7:57                           ` Greg A. Woods
2024-06-17 23:44                             ` Warner Losh
2024-06-18  0:06                               ` Larry McVoy
2024-06-18 22:44                               ` Greg A. Woods
2024-06-19  2:33                                 ` David Arnold
2024-06-18  1:52                             ` Steve Nickolas
2024-06-18  4:52                               ` segaloco via TUHS
2024-06-18 22:50                                 ` Greg A. Woods
2024-06-18 23:03                                   ` Warner Losh
2024-06-18 23:27                                     ` ron minnich
2024-06-19  1:38                                     ` Greg 'groggy' Lehey
2024-06-19  1:42                                       ` Warner Losh
2024-06-19 23:28                                         ` Greg A. Woods
2024-06-20  5:01                                           ` Scot Jenkins via TUHS
2024-06-20  5:09                                             ` Luther Johnson
2024-06-20  5:18                                               ` Luther Johnson
2024-06-20 18:34                                             ` Greg A. Woods
2024-06-20 18:41                                               ` Adam Thornton
2024-06-20 19:59                                                 ` Warner Losh
2024-06-20 20:12                                                   ` ron minnich
2024-06-20 20:22                                                     ` Adam Thornton
2024-06-20 20:29                                                     ` ron minnich
2024-06-21 15:46                                                     ` Chet Ramey via TUHS
2024-06-21 16:06                                                       ` Henry Bent
2024-06-21 16:24                                                         ` Chet Ramey via TUHS
2024-06-21 16:40                                                           ` Henry Bent
2024-06-21 16:52                                                             ` Warner Losh
2024-06-21 17:25                                                             ` Chet Ramey via TUHS
2024-06-21 17:31                                                             ` Phil Budne
2024-06-21 17:55                                                               ` Chet Ramey via TUHS
2024-06-20 20:19                                                   ` Clem Cole
2024-06-20 20:34                                                   ` Luther Johnson
2024-06-20 21:00                                                     ` ron minnich
2024-06-20 21:53                                                       ` David Arnold
2024-06-20 22:00                                                         ` ron minnich
2024-06-20 22:11                                                           ` Larry McVoy
2024-06-20 22:35                                                       ` Luther Johnson
2024-06-21 13:57                                                       ` Stuff Received
2024-06-20 19:57                                               ` [TUHS] Version 256.1: Now slightly less likely to delete /home Jim Capp
2024-06-20  8:05                                           ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' The Register Steve Nickolas
2024-06-19  2:38                                     ` David Arnold
2024-06-19 22:52                                     ` Greg A. Woods
2024-06-19  0:08                                   ` Luther Johnson
2024-06-19  0:46                                     ` Nevin Liber
2024-06-19  1:00                                       ` segaloco via TUHS
2024-06-19  3:07                                       ` Luther Johnson
2024-06-19  3:14                                         ` Luther Johnson
2024-06-19  3:36                                           ` Luther Johnson
2024-06-19  6:50                                           ` arnold
2024-06-19 11:28                                             ` sjenkin
2024-06-19  9:00                                         ` Ralph Corderoy
2024-06-19 13:28                                       ` Larry McVoy [this message]
2024-06-19 14:44                                         ` Warner Losh
2024-06-19 14:53                                           ` Larry McVoy
2024-06-19 15:08                                             ` Warner Losh
2024-06-19 15:11                                             ` G. Branden Robinson
2024-06-19 15:16                                             ` ron minnich
2024-06-19 15:59                                         ` Theodore Ts'o
2024-06-19 22:48                                           ` Kevin Bowling
2024-06-20  5:14                                             ` David Arnold
2024-06-20  5:32                                               ` George Michaelson
2024-06-20  6:37                                                 ` Alexis
2024-06-20  7:07                                                   ` David Arnold
2024-06-20 21:07                                                   ` [TUHS] Building programs (Re: " Bakul Shah via TUHS
2024-06-20 23:35                                                     ` [TUHS] " Alexis
2024-06-21  0:05                                                       ` Warner Losh
2024-06-21  0:34                                                         ` Alexis
2024-06-21  0:54                                                           ` Greg A. Woods
2024-06-21  1:06                                                             ` G. Branden Robinson
2024-06-21  1:32                                                             ` Alexis
2024-06-21  1:43                                                               ` Warner Losh
2024-06-21 16:07                                                           ` Chet Ramey via TUHS
2024-06-21  0:35                                                       ` Bakul Shah via TUHS
2024-06-21  1:15                                                         ` Alexis
2024-06-21  1:43                                                           ` segaloco via TUHS
2024-06-21 13:58                                                             ` Alan D. Salewski
2024-06-21  0:35                                                       ` Larry McVoy
2024-06-21  0:49                                                         ` Alexis
2024-06-21  1:22                                                           ` Greg A. Woods
2024-06-21  1:44                                                             ` Kevin Bowling
2024-06-21 15:57                                                       ` Chet Ramey via TUHS
2024-06-22  0:04                                                         ` Alexis
2024-06-22 17:53                                                           ` Chet Ramey via TUHS
2024-06-22 18:15                                                             ` Luther Johnson
2024-06-22 21:16                                                               ` David Arnold
2024-06-23  0:29                                                                 ` segaloco via TUHS
2024-06-23 18:50                                                                 ` Theodore Ts'o
2024-06-23 18:56                                                               ` Chet Ramey via TUHS
2024-06-23 20:15                                                                 ` Stuff Received
2024-06-24 14:03                                                                   ` Theodore Ts'o
2024-06-24 14:33                                                                     ` Dan Cross
2024-06-24 15:17                                                                       ` Warner Losh
2024-06-24 15:23                                                                   ` Chet Ramey via TUHS
2024-06-21 15:41                               ` [TUHS] " Chet Ramey via TUHS
2024-06-21 15:38                           ` Chet Ramey via TUHS
2024-06-20 20:14                       ` Alexander Schreiber
2024-06-16  6:43                 ` Wesley Parish
2024-06-16 21:56               ` David Arnold
2024-06-16 23:34                 ` Luther Johnson
2024-06-16 23:46                   ` Larry McVoy
2024-06-17 21:40                     ` Steffen Nurpmeso
2024-06-17  0:54                 ` Åke Nordin
2024-06-18  5:55                 ` Alexis
2024-06-18  6:39                   ` Michael Kjörling
2024-06-13 19:37       ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' • " Alan D. Salewski
2024-06-13 20:05         ` Clem Cole
2024-06-13 20:31           ` Bakul Shah via TUHS
2024-06-13 20:06         ` A. P. Garcia
2024-06-13 20:26           ` Jim Capp
2024-06-13 21:35           ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' ??? " Larry McVoy
2024-06-14  0:27         ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' • " Alexis
2024-06-14  0:59           ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' ??? " Larry McVoy
2024-06-14  1:11             ` Luther Johnson
2024-06-14  1:42             ` Alexis
2024-06-14  4:22               ` ron minnich
2024-06-14  6:54               ` Angel M Alganza
2024-06-14  7:04             ` Dave Horsfall
2024-06-14  7:33             ` arnold
2024-06-14  7:34             ` Andy Kosela
2024-06-14  7:44               ` Dave Horsfall
2024-06-14 11:31             ` Vincenzo Nicosia
2024-06-13 20:26     ` [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' • " Dave Horsfall
2024-06-14 11:32       ` Michael Kjörling
2024-06-14 12:21         ` A. P. Garcia
2024-06-18 12:02           ` Arrigo Triulzi via TUHS
2024-06-23  0:13         ` Dave Horsfall
2024-06-23  1:47           ` Alexis
2024-06-23 19:00             ` Theodore Ts'o
2024-06-23 20:04               ` Alexander Schreiber
2024-06-24 13:50                 ` Theodore Ts'o
2024-06-24 14:21                   ` Dan Cross
2024-06-26  7:39                     ` Kevin Bowling
2024-06-24 15:03                   ` Steffen Nurpmeso
2024-06-17  0:48 [TUHS] Re: Version 256 of systemd boasts '42% less Unix philosophy' " Noel Chiappa
2024-06-17  1:02 ` Clem Cole
2024-06-17  1:05 ` Larry McVoy
2024-06-17  3:56   ` ron minnich
2024-06-17  3:57     ` ron minnich
2024-06-17  5:41       ` Bakul Shah via TUHS
2024-06-17  5:51         ` Bakul Shah via TUHS
2024-06-17 15:56           ` Clem Cole
2024-06-17 16:00             ` Clem Cole
2024-06-17 16:59               ` Charles H Sauer (he/him)
2024-06-17 16:43             ` Larry McVoy
2024-06-17 22:49         ` Steffen Nurpmeso
2024-06-20 16:45 Lyndon Nerenberg (VE7TFX/VE6BBM)
2024-06-20 18:32 ` Kevin Bowling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240619132846.GR32048@mcvoy.com \
    --to=lm@mcvoy.com \
    --cc=nliber@gmail.com \
    --cc=tuhs@tuhs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).