mk

Makefile templates
git clone git://git.margiolis.net/mk.git
Log | Files | Refs | README | LICENSE

commit 17aceb91129f910c6bcb4fd08492f8edd4c10e5d
parent 84d8b951c66c8bd8c1be7661dc7b0b5597f65777
Author: Christos Margiolis <christos@margiolis.net>
Date:   Tue, 26 Apr 2022 19:48:45 +0300

foobar

Diffstat:
MREADME | 3+++
Marduino_fbsd.mk | 14++++++++------
Mconfig.mk | 2++
Apic.mk | 36++++++++++++++++++++++++++++++++++++
Msh.mk | 28++++++++++++++++------------
5 files changed, 65 insertions(+), 18 deletions(-)

diff --git a/README b/README @@ -1,3 +1,6 @@ +mk +== + This repo contains Makefiles I use regularly in my projects. The <++> is a placeholder I've set up for Vim, it's not Makefile related. Replace each <++> with the appropriate data. diff --git a/arduino_fbsd.mk b/arduino_fbsd.mk @@ -1,7 +1,9 @@ -ARDUINO_DIR = /usr/local/arduino -ARDMK_DIR = /usr/local/arduino-mk -ARDUINO_LIBS = /usr/local/arduino/libraries -ARDUINO_PORT = /dev/cuaU0 -ARDUINO_BOARD = uno +ARDUINO_DIR= /usr/local/arduino +ARDUINO_MK_DIR= /usr/local/arduino-bsd-mk +#ARDUINO_LIBS= /usr/local/arduino/hardware/arduino/avr/libraries/ +AVRDUDE_PORT= /dev/cuaU0 +ARDUINO_BOARD= uno +SRCS= lcd.c +TARGET= lcd -include /usr/local/arduino-mk/Arduino.mk +include /usr/local/arduino-bsd-mk/bsd.arduino.mk diff --git a/config.mk b/config.mk @@ -5,6 +5,8 @@ VERSION = <++> # paths PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man +# OpenBSD +#MANPREFIX = ${PREFIX}/man # uncomment if you're building a library #INCDIR = ${PREFIX}/include #LIBDIR = ${PREFIX}/lib diff --git a/pic.mk b/pic.mk @@ -0,0 +1,36 @@ +# See LICENSE file for copyright and license details. +# <++> +.POSIX: + +BIN = <++> +CC = sdcc +CPPFLAGS = +CFLAGS = --use-non-free -mpic<++> -p<++> ${CPPFLAGS} +PIC = <++> + +SRC = <++> +OBJ = ${SRC:.c=.o} + +all: options ${BIN} + +options: + @echo ${BIN} build options: + @echo "CC = ${CC}" + @echo "CFLAGS = ${CFLAGS}" + +${BIN}: ${OBJ} + ${CC} ${OBJ} ${CFLAGS} -o $@ + +.c.o: + ${CC} -c ${CFLAGS} $< + +flash: all + pk2cmd -P ${PIC} -X -M -F ${BIN}.hex + +erase: + pk2cmd -P ${PIC} -E ${BIN}.hex + +clean: + rm -f *.hex *.asm *.cod *.hex *.lst *.o *.core + +.PHONY: all options clean flash clean diff --git a/sh.mk b/sh.mk @@ -2,15 +2,16 @@ # <++> .POSIX: -SH = <++> +TARGS = <++> VERSION = <++> -DIST = ${SH}-${VERSION} -MAN1 = ${SH}.1 +DIST = <++>-${VERSION} PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man +# OpenBSD +#MANPREFIX = ${PREFIX}/man -all: ${SH} - chmod +x ${SH} +all: ${TARGS} + chmod +x ${TARGS} dist: mkdir -p ${DIST} @@ -21,15 +22,18 @@ dist: install: all mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${MANPREFIX}/man1 - cp -f ${SH} ${DESTDIR}${PREFIX}/bin - cp -f ${MAN1} ${DESTDIR}${MANPREFIX}/man1 - sed "s/VERSION/${VERSION}/g" < ${MAN1} > ${DESTDIR}${MANPREFIX}/man1/${MAN1} - chmod 755 ${DESTDIR}${PREFIX}/bin/${SH} - chmod 644 ${DESTDIR}${MANPREFIX}/man1/${MAN1} + cp -f ${TARGS} ${DESTDIR}${PREFIX}/bin + for targ in ${TARGS} ; do \ + sed "s/VERSION/${VERSION}/g" < $${targ}.1 > ${DESTDIR}${MANPREFIX}/man1/$${targ}.1 \ + chmod 755 ${DESTDIR}${PREFIX}/bin/$${targ} ; \ + chmod 644 ${DESTDIR}${MANPREFIX}/man1/$${targ}.1 ; \ + done uninstall: - rm -f ${DESTDIR}${PREFIX}/bin/${SH} \ - ${DESTDIR}${MANPREFIX}/man1/${MAN1} + for targ in ${TARGS} ; do \ + rm -f ${DESTDIR}${PREFIX}/bin/$${targ} ; \ + rm -f ${DESTDIR}${MANPREFIX}/man1/$${targ}.1 ; \ + done clean: rm -f ${DIST}.tar.gz