2023-08-14 06:01:29 +00:00
|
|
|
# Copyright (c) 2023 Emma Tebibyte
|
2023-07-24 03:54:43 +00:00
|
|
|
# SPDX-License-Identifier: FSFAP
|
|
|
|
#
|
|
|
|
# Copying and distribution of this file, with or without modification, are
|
|
|
|
# permitted in any medium without royalty provided the copyright notice and this
|
|
|
|
# notice are preserved. This file is offered as-is, without any warranty.
|
|
|
|
|
|
|
|
.POSIX:
|
|
|
|
|
2023-08-29 05:03:33 +00:00
|
|
|
PREFIX=/usr/local
|
|
|
|
CFLAGS=-O3 -s -Wl,-z,noseparate-code,-z,nosectionheader -flto -Lbuild -lyac
|
2023-07-24 03:54:43 +00:00
|
|
|
|
2023-08-29 05:15:08 +00:00
|
|
|
build: build_dir cat false tail true
|
2023-08-29 19:23:29 +00:00
|
|
|
rm build/yac.o
|
2023-07-24 03:54:43 +00:00
|
|
|
|
2023-08-11 02:10:30 +00:00
|
|
|
clean: build_dir
|
|
|
|
rm -rf build/
|
|
|
|
|
2023-08-29 05:15:08 +00:00
|
|
|
cat: build_dir lib
|
2023-08-14 06:01:29 +00:00
|
|
|
cc $(CFLAGS) -o build/cat src/cat.c
|
2023-07-24 03:54:43 +00:00
|
|
|
|
2023-08-29 05:15:08 +00:00
|
|
|
false: build_dir lib
|
2023-08-14 06:01:29 +00:00
|
|
|
cc $(CFLAGS) -o build/false src/false.c
|
2023-07-24 03:54:43 +00:00
|
|
|
|
2023-08-29 05:15:08 +00:00
|
|
|
tail: build_dir lib
|
2023-08-29 05:03:33 +00:00
|
|
|
cc $(CFLAGS) -o build/tail src/tail.c
|
|
|
|
|
2023-08-29 05:15:08 +00:00
|
|
|
true: build_dir lib
|
2023-08-14 06:01:29 +00:00
|
|
|
cc $(CFLAGS) -o build/true src/true.c
|
2023-07-24 03:54:43 +00:00
|
|
|
|
2023-08-29 05:03:33 +00:00
|
|
|
lib:
|
2023-08-29 05:15:08 +00:00
|
|
|
cc $(CFLAGS) -c -fPIC -o build/yac.o src/yac.c
|
|
|
|
cc -shared -o build/libyac.so build/yac.o
|
2023-08-29 05:03:33 +00:00
|
|
|
|
2023-07-24 03:54:43 +00:00
|
|
|
build_dir:
|
|
|
|
mkdir -p build
|
|
|
|
|
|
|
|
install: build
|
2023-08-29 19:23:29 +00:00
|
|
|
mkdir -p $(PREFIX)/lib $(PREFIX)/bin
|
2023-08-29 05:03:33 +00:00
|
|
|
cp -f build/*.so $(PREFIX)/lib/
|
|
|
|
cp -f build/* $(PREFIX)/bin/
|