@ -1,47 +1,31 @@
VERSION = "0.3.2\\nCopyright (c) 2021, Ruthenic. Licensed under BSD-3-Clause."
i f n d e f C C
CC = gcc
e n d i f
target := $( shell ${ CC } -dumpmachine)
i f n d e f C C _ F L A G S
#guess we gotta define this if it no exist, \
but imagine not needing custom cxx flags
CC_FLAGS :=
e n d i f
CC_FLAGS := -Ilib ${ CC_FLAGS }
i f n d e f P R O G S
PROGS := arch basename cat chroot cp ls pwd rm uname whoami yes
e n d i f
i f n d e f E X C L U D E _ P R O G S
EXCLUDE_PROGS := rm
e n d i f
i f n d e f D E S T D I R
DESTDIR := /
e n d i f
CC ?= gcc
target ?= $( shell ${ CC } -dumpmachine)
CC_FLAGS ?=
PROGS ?= arch basename cat chroot cp ls pwd rm uname whoami yes
EXCLUDE_PROGS ?= rm
DESTDIR ?= /
.PHONY: all
.DEFAULT : all
all :
@mkdir -p bin
all : ${PROGS }
${PROGS} : %: src /%.c
@#for some idiotic reason, i can' t define 2 ` all` targets, one of which can make this directory
@mkdir -p bin
@echo Building $@ ..
@${ CC } -o bin/$@ -DDRAKECU_VERSION= \" ${ VERSION } \" ${ CC_FLAGS } $<
${PROGS} :
@echo Building $@ ..
@${ CC } -o bin/$@ -DDRAKECU_VERSION= \' 0.3.2\\ n© Ruthenic, 2021\'
.PHONY : debug
debug : CC_FLAGS :=-g -O 0 -v ${CC_FLAGS }
debug : all
.PHONY : clean
clean :
@rm -rf bin
.PHONY : strip
strip :
build-release : CC_FLAGS :=-O 3
build-release : all
build-release :
@strip bin/*
tar -czf release.tar.gz bin/*
.PHONY : install
#TODO: fix this, this is terrible oh god help me
install :
@for prog in ${ EXCLUDE_PROGS } ; do \
mv bin/$$ prog /tmp; \
@ -50,11 +34,3 @@ install:
@for prog in ${ EXCLUDE_PROGS } ; do \
mv /tmp/$$ prog bin; \
done
.PHONY : help
help :
@echo "Drake's Epic Coreutils Makefile Help Page™"
@echo 'make' - build normal version.
@echo 'make debug' - build verbosly, and with \` -g -O0\` for the lowest amount of compiler optimization, so that valgrind and such can report line numbers, and have more information in general.
@echo 'make clean' - removes binaries.
@echo 'make help' - display this help message.