You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1002 B

VERSION = "\"0.3.2\\n© Ruthenic, 2021-2022\""
CC ?= gcc
target ?= $(shell ${CC} -dumpmachine)
CC_FLAGS ?=
CC_FLAGS := -Ilib
PROGS ?= arch basename cat chroot cp ls pwd rm uname whoami yes
EXCLUDE_PROGS ?= rm
DESTDIR ?= /
.PHONY: all debug clean build-release install
all:
@$(shell mkdir -p bin)
all: ${PROGS}
all: dbox
${PROGS}:
@echo Building $@..
@${CC} -c -o bin/$@.o -DDRAKECU_VERSION=${VERSION} ${CC_FLAGS} src/$@.c
dbox:
@${CC} -o bin/dbox src/dbox.c ${CC_FLAGS} $(wildcard bin/*.o)
debug: CC_FLAGS:=-g -O0 -v ${CC_FLAGS}
debug: all
clean:
@rm -rf bin
build-release: CC_FLAGS:=-O3 ${CC_FLAGS}
build-release: all
build-release:
@strip bin/*
tar -czf release.tar.gz bin/*
install:
@install -m 777 bin/dbox ${DESTDIR}/usr/local/bin
@for prog in ${PROGS}; do \
ln ${DESTDIR}/usr/local/bin/dbox ${DESTDIR}/usr/local/bin/$$prog; \
done
#I sincerly hope that my `rm` is stable enough to do this.
@for prog in ${EXCLUDE_PROGS}; do \
rm ${DESTDIR}/usr/local/bin/$$prog; \
done