2023-08-14 00:01:29 -06:00
|
|
|
# Copyright (c) 2023 Emma Tebibyte
|
2023-07-23 21:54:43 -06: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-28 23:03:33 -06:00
|
|
|
PREFIX=/usr/local
|
|
|
|
CFLAGS=-O3 -s -Wl,-z,noseparate-code,-z,nosectionheader -flto -Lbuild -lyac
|
2023-07-23 21:54:43 -06:00
|
|
|
|
2023-08-28 23:15:08 -06:00
|
|
|
build: build_dir cat false tail true
|
2023-07-23 21:54:43 -06:00
|
|
|
|
2023-08-10 20:10:30 -06:00
|
|
|
clean: build_dir
|
|
|
|
rm -rf build/
|
|
|
|
|
2023-08-28 23:15:08 -06:00
|
|
|
cat: build_dir lib
|
2023-08-14 00:01:29 -06:00
|
|
|
cc $(CFLAGS) -o build/cat src/cat.c
|
2023-07-23 21:54:43 -06:00
|
|
|
|
2023-08-28 23:15:08 -06:00
|
|
|
false: build_dir lib
|
2023-08-14 00:01:29 -06:00
|
|
|
cc $(CFLAGS) -o build/false src/false.c
|
2023-07-23 21:54:43 -06:00
|
|
|
|
2023-08-28 23:15:08 -06:00
|
|
|
tail: build_dir lib
|
2023-08-28 23:03:33 -06:00
|
|
|
cc $(CFLAGS) -o build/tail src/tail.c
|
|
|
|
|
2023-08-28 23:15:08 -06:00
|
|
|
true: build_dir lib
|
2023-08-14 00:01:29 -06:00
|
|
|
cc $(CFLAGS) -o build/true src/true.c
|
2023-07-23 21:54:43 -06:00
|
|
|
|
2023-08-28 23:03:33 -06:00
|
|
|
lib:
|
2023-08-28 23:15:08 -06:00
|
|
|
cc $(CFLAGS) -c -fPIC -o build/yac.o src/yac.c
|
|
|
|
cc -shared -o build/libyac.so build/yac.o
|
2023-08-28 23:03:33 -06:00
|
|
|
|
2023-07-23 21:54:43 -06:00
|
|
|
build_dir:
|
|
|
|
mkdir -p build
|
|
|
|
|
|
|
|
install: build
|
|
|
|
mkdir -p $(PREFIX)
|
2023-08-28 23:03:33 -06:00
|
|
|
cp -f build/*.so $(PREFIX)/lib/
|
|
|
|
cp -f build/* $(PREFIX)/bin/
|