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.
29 lines
517 B
29 lines
517 B
2 years ago
|
CC ?= gcc
|
||
|
target ?= $(shell ${CC} -dumpmachine)
|
||
|
CC_FLAGS ?=
|
||
|
CC_FLAGS := ${CC_FLAGS} -Ilib
|
||
|
DESTDIR ?= /
|
||
|
|
||
|
.PHONY: all debug clean build-release install
|
||
|
all:
|
||
|
@$(shell mkdir -p bin)
|
||
|
all: main
|
||
|
|
||
|
main:
|
||
|
@${CC} -o bin/main src/main.c ${CC_FLAGS}
|
||
|
|
||
|
debug: CC_FLAGS:=-g -O0 -v -fsanitize=undefined -fsanitize=address ${CC_FLAGS}
|
||
|
debug: all
|
||
|
|
||
|
clean:
|
||
|
@rm -rf bin
|
||
|
|
||
|
release: CC_FLAGS:=-O3 ${CC_FLAGS}
|
||
|
release: all
|
||
|
release:
|
||
|
@strip bin/*
|
||
|
tar -czf release.tar.gz bin/*
|
||
|
|
||
|
install:
|
||
|
@install -m 777 bin/main ${DESTDIR}/usr/local/bin
|