! In T271#3845, @nrgaway wrote:
Looks good; I will need to test it to make sure that I can set GENMKFILE_INCLUDE_FILE_MAIN
to 0 to skip loading the Makefile.
Just again specifically tested this. Works. You can ignore the main one and source your own make file and targets in pre.
! In T271#3838, @Patrick wrote:
There are two specific Makefiles (can probably not be avoided)
Maybe can be avoided by auto detecting the path? It’s just 3 different locations we can try. Then the exact same makefile can be used everywhere? No need to have a special bootstrap one? I am unsure about it. When using make from within Whonix/Whonix or genmkfile it should always use the local one?
(With “local” I mean ./packages/genmkfile/usr/share/genmkfile here. Not the system wide installed one.)
Got this working in this revision.
! In T271#3847, @nrgaway wrote:
I do not even know what the current purpose of the make file is. I would personally be using it to build the gateway, build debs, sign tags, update repos… everything. Your makefile can call your scripts as needed.
The purpose of genmkfile is described here:
genmkfile/debian/control at master · Kicksecure/genmkfile · GitHub
It’s purpose is to avoid having to define “install file x to /usr/bin/x” for each individual file in each individual package. That’s something I find awful. Because when you ever rename files in the package, you also have to update the makefile. Too much effort for something as simple as scripts and config files as I find.
With genmkfile each individual package just needs this minimal makefile. It’s purpose is to require seldom upgrades. It sources a more comprehensive makefile-full that implements all the real targets such as make install, make installcheck, make uninstall and much more (see make help). Since I find makefiles hard to write (; \ syntax) and debug (no xtrace), the heavy lifting is done by make-helper.bsh. makefile-full and make-helper.bsh which are in the genmkfile package can be often upgraded and all packages benefit from it without requiring to copy/commit a new version.
How to you call the make file to begin with?
For example if troubadour works on whonix-setup-wizard, he can just needs to have genmkfile installed as a build dependency (git clone and “make deb-icup”) and can then use in whonix-setup-wizard “make install”, “make deb-icup” and others without needing to understand a lot about makefiles and such. It’s all nicely abstracted into genmkfile. So can other users/developers easily git clone and play around with a package. When I come up with new hot features such as short commands to quickly bump version number, create and add a package to the repository, I don’t have to commit to individual packages such as whonix-setup-wizard.
For Whonix/Whonix I can understand the confusion. It’s Makefile is not that useful yet. Some stuff is useful for developers such as “make git-verify”. Another plan of mine was to package whole images generated by Whonix/Whonix as deb package. It’s not yet in use to build Whonix images. That’s only whonix_build.
It does not look like you need 3 make files that are mostly identical.
Yes. Now it autodetects the path. Why are these two exceptions? Well, for genmkfile, I would like to use genmkfile to build genmkfile package. To avoid a circular build dependency (on on itself), I use the same one that comes with genmkfile. And for Whonix/Whonix to avoid having to install genmkfile just to use the makefile.
To build default workstation and gateway (would read from a .conf file for options)
make gateway
gateway:
whonix_build $(OPTIONS)
debs:
bash script code to make debs?
The makefile for Whonix/Whonix could indeed have additional features that individual packages don’t need (make debs, make gateway). Additional features that are only needed for Whonix/Whonix that are not useful for genmkfile. That’s another story.
#!/usr/bin/make -f
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
## genmkfile - Makefile - version 1.6
## This is a copy.
## master location:
## https://github.com/Whonix/genmkfile/blob/master/usr/share/genmkfile/Makefile
.PHONY: about
GENMKFILE_NAME ?= makefile-full
GENMKFILE_BOOTSTRAP_ONE ?= ./packages/genmkfile/usr/share/genmkfile/$(GENMKFILE_NAME)
GENMKFILE_BOOTSTRAP_TWO ?= ./usr/share/genmkfile/$(GENMKFILE_NAME)
GENMKFILE_PATH ?= /usr/share/genmkfile
GENMKFILE_ROOT_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
GENMKFILE_CURRENT := $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
ifndef GENMKFILE_INCLUDE_FILE_MAIN
ifneq (,$(wildcard $(GENMKFILE_BOOTSTRAP_ONE)))
GENMKFILE_INCLUDE_FILE_MAIN := $(GENMKFILE_BOOTSTRAP_ONE)
else ifneq (,$(wildcard $(GENMKFILE_BOOTSTRAP_TWO)))
GENMKFILE_INCLUDE_FILE_MAIN := $(GENMKFILE_BOOTSTRAP_TWO)
else
GENMKFILE_INCLUDE_FILE_MAIN := $(GENMKFILE_PATH)/$(GENMKFILE_NAME)
endif
endif
export GENMKFILE_NAME
export GENMKFILE_PATH
export GENMKFILE_ROOT_DIR
export GENMKFILE_INCLUDE_FILE_MAIN
export GENMKFILE_CURRENT
about:
@echo "GENMKFILE_CURRENT: $(GENMKFILE_CURRENT)"
ifdef GENMKFILE_INCLUDE_FILE_PRE
ifeq (,$(wildcard $(GENMKFILE_INCLUDE_FILE_PRE)))
$(error GENMKFILE_INCLUDE_FILE_PRE $(GENMKFILE_INCLUDE_FILE_PRE) does not exist!)
else
include $(GENMKFILE_INCLUDE_FILE_PRE)
endif
endif
ifneq ($(GENMKFILE_INCLUDE_FILE_MAIN),0)
ifeq (,$(wildcard $(GENMKFILE_INCLUDE_FILE_MAIN)))
$(error GENMKFILE_INCLUDE_FILE_MAIN $(GENMKFILE_INCLUDE_FILE_MAIN) does not exist!)
else
include $(GENMKFILE_INCLUDE_FILE_MAIN)
endif
endif
ifdef GENMKFILE_INCLUDE_FILE_POST
ifeq (,$(wildcard $(GENMKFILE_INCLUDE_FILE_POST)))
$(error GENMKFILE_INCLUDE_FILE_POST $(GENMKFILE_INCLUDE_FILE_POST) does not exist!)
else
include $(GENMKFILE_INCLUDE_FILE_POST)
endif
endif