BOOTSTRAP = http://raspbian.raspberrypi.org/raspbian
 
 define SOURCES = 
-deb    http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi\n\
-deb    http://archive.raspberrypi.org/debian stretch main\n
+deb    http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi
+deb    http://archive.raspberrypi.org/debian stretch main
 endef
 
 PACKAGES := apt bluez bluez-firmware bluez-tools btrfs-tools busybox-static bzip2 ca-certificates cron debian-archive-keyring deborphan firmware-brcm80211 firmware-linux-free firmware-misc-nonfree gzip htop ifupdown init iputils-ping irqbalance isc-dhcp-client less libraspberrypi-bin libraspberrypi0 make net-tools nmap ntpdate openssh-client openssh-server pi-bluetooth raspberrypi-bootloader raspberrypi-kernel rsync ssh sshfs sudo systemd traceroute unzip vim wget wireless-tools wpasupplicant xz-utils zip
 WIFI-SSID = 
 WIFI-PASS = 
 
+IMGFILE = raspi.img
+
 config.mk: config.example
        cp -n "$<" "$@"
+include config.mk
 
 .PHONY: imgfile imgmount root_copy norecommends apt_keys
-
-IMGFILE = raspi.img
-
-include config.mk
-include *.mk
+export SOURCES
 
 raspi_root:
        btrfs subvolume create "$@" || mkdir "$@"
        printf 'APT::Install-Recommends "false";\n' >"$@"
        chmod 644 "$@"
 
-apt_keys:
-       -chroot "$@" apt-key add - <./raspbian-archive-keyring.gpg
-       -chroot "$@" apt-key add - <./raspberrypi-archive-keyring.gpg
-       -chroot "$@" apt-key add - <./debian-archive-stretch-stable.gpg
+apt_keys: raspi_root
+       -chroot "$<" apt-key add - <./raspbian-archive-keyring.gpg
+       -chroot "$<" apt-key add - <./raspberrypi-archive-keyring.gpg
+       -chroot "$<" apt-key add - <./debian-archive-stretch-stable.gpg
 
 raspi_root/: raspi_root norecommends apt_keys .FORCE
-       printf '${SOURCES}' >$@/etc/apt/sources.list
+       printf %s "$$SOURCES" >$@/etc/apt/sources.list
        -cp /etc/resolv.conf "$@etc/"
        -chroot "$@" sh -c 'apt-mark showmanual |xargs apt-mark auto'
        -chroot "$@" apt-get update
 
 # Name this file config.mk to override options from the main Makefile
 
 # define SOURCES = 
-# deb     http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi\n\
-# deb     http://archive.raspberrypi.org/debian stretch main\n
+# deb     http://raspbian.raspberrypi.org/raspbian stretch main non-free firmware rpi
+# deb     http://archive.raspberrypi.org/debian stretch main
 # endef
 
 # BOOTSTRAP := http://raspbian.raspberrypi.org/raspbian
-
 # PACKAGES := ${PACKAGES} foo bar ... additional packages
 
+# include xfce.mk
+# include ws5inch.mk
+
 # WIFI-SSID = 
 # WIFI-PASS =
 
 # PHONY: rootpass
 # ${IMGFILE}: rootpass
 # rootpass: imgmount root_copy
-#      -chroot "$<" usermod -p "$(openssl passwd -1 -salt aaa password)" root
+#      -chroot "$<" usermod -p "$$(openssl passwd -salt "x$$RANDOM" password)" root
 
 
 dtparam=audio=on
 # dtoverlay=w1-gpio
-
-hdmi_group=2
-hdmi_mode=87
-hdmi_cvt=800 480 60 6 0 0 0
-hdmi_drive=1
 
+++ /dev/null
-#!/bin/sh
-
-usermod -p "$(openssl passwd -1 -salt ert root)" root
-useradd -m local
 
--- /dev/null
+Section "InputClass"
+       Identifier "evdev touchscreen catchall"
+       MatchIsTouchscreen "on"
+       Option  "Calibration"   "200 3950 250 4000"
+       MatchDevicePath "/dev/input/event*"
+       Driver "evdev"
+EndSection
 
--- /dev/null
+define ws5inch_boot =
+hdmi_group=2
+hdmi_mode=87
+hdmi_cvt=800 480 60 6 0 0 0
+hdmi_drive=1
+
+dtparam=i2c_arm=on
+dtparam=spi=on
+enable_uart=1
+dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
+endef
+export ws5inch_boot
+
+PACKAGES := ${PACKAGES} xserver-xorg-input-evdev xinput xinput-calibrator
+
+.PHONY: ws5inch
+${IMGFILE}: ws5inch
+ws5inch: imgmount root_copy files_ws5inch/
+       cp -a files_ws5inch/. "$</"
+       printf %s "$$ws5inch_boot" >>"$</boot/config.txt"
+       -chroot "$<" adduser local input
 
 PACKAGES := ${PACKAGES} xserver-xorg-video-fbturbo xserver-xorg xserver-xorg-input-evdev nodm xfce4 xauth x2x xvkbd blueman xfce4-terminal xinput xinput-calibrator xfce4-clipman-plugin xfce4-whiskermenu-plugin
 
-.PHONY: xuser xfce
-
-${IMGFILE}: xuser xfce
-
-xuser: imgmount root_copy
-       -chroot "$<" useradd -m local
-
-xfce: imgmount files_xfce/
+.PHONY: xfce
+${IMGFILE}: xfce
+xfce: imgmount root_copy files_xfce/
        cp -a files_xfce/. "$</"
+       -chroot "$<" useradd -m local