shithub: pc

ref: 25251bab5307ad72727f0229f88c36fb2620ace7
dir: /Makefile/

View raw version
TARGET=pc
DESTDIR?=
PREFIX?=/usr/local
BIN=${DESTDIR}${PREFIX}/bin
MAN=${DESTDIR}${PREFIX}/share/man/man1
CFLAGS?=-g -O2
CFLAGS+=-Iinclude -Wall -Wno-missing-braces -Wno-parentheses -Wno-incompatible-pointer-types

OBJS=\
	libc/dofmt.o\
	libc/dorfmt.o\
	libc/encodefmt.o\
	libc/fltfmt.o\
	libc/fmt.o\
	libc/fmtfd.o\
	libc/fmtfdflush.o\
	libc/fmtlock.o\
	libc/fmtprint.o\
	libc/fmtquote.o\
	libc/fmtrune.o\
	libc/fmtstr.o\
	libc/fmtvprint.o\
	libc/fprint.o\
	libc/genrandom.o\
	libc/mallocz.o\
	libc/nan64.o\
	libc/print.o\
	libc/rune.o\
	libc/snprint.o\
	libc/sprint.o\
	libc/strtod.o\
	libc/sysfatal.o\
	libc/u16.o\
	libc/u32.o\
	libc/u64.o\
	libc/utflen.o\
	libc/vfprint.o\
	libc/vsnprint.o\
	libmp/betomp.o\
	libmp/cnfield.o\
	libmp/gmfield.o\
	libmp/letomp.o\
	libmp/mpadd.o\
	libmp/mpaux.o\
	libmp/mpcmp.o\
	libmp/mpdigdiv.o\
	libmp/mpdiv.o\
	libmp/mpexp.o\
	libmp/mpextendedgcd.o\
	libmp/mpfield.o\
	libmp/mpfmt.o\
	libmp/mpinvert.o\
	libmp/mpleft.o\
	libmp/mplogic.o\
	libmp/mpmod.o\
	libmp/mpmodop.o\
	libmp/mpmul.o\
	libmp/mpnrand.o\
	libmp/mprand.o\
	libmp/mpright.o\
	libmp/mpsel.o\
	libmp/mpsub.o\
	libmp/mptobe.o\
	libmp/mptober.o\
	libmp/mptoi.o\
	libmp/mptole.o\
	libmp/mptolel.o\
	libmp/mptoui.o\
	libmp/mptouv.o\
	libmp/mptov.o\
	libmp/mpvecadd.o\
	libmp/mpveccmp.o\
	libmp/mpvecdigmuladd.o\
	libmp/mpvecsub.o\
	libmp/mpvectscmp.o\
	libmp/strtomp.o\
	${TARGET}.o\

.PHONY: all default install uninstall clean

all: default

default: ${TARGET}

install: ${TARGET}
	install -d ${BIN}
	install -m 755 ${TARGET} ${BIN}
	install -d ${MAN}
	install -m 644 ${TARGET}.1 ${MAN}

uninstall:
	rm -f ${BIN}/${TARGET} ${MAN}/${TARGET}.1

clean:
	rm -f ${TARGET} ${OBJS} ${TARGET}.c

${TARGET}: ${OBJS}
	${CC} -o $@ ${OBJS}

pc.c: pc.y
	yacc -o $@ $<

.SUFFIXES: .c .o
.c.o:
	${CC} -o $@ -c $< ${CFLAGS}