commit 1ac4e3b119bb2d3508fd9c9c524f1cce33a665a4 parent 50e1e1851facbee0d9d90d8c05a7663adc7c1cf3 Author: zavok <an2qzavok@gmail.com> Date: Thu, 24 Sep 2020 14:48:03 +0300 copy Makefile from pcmprint Diffstat:
M | Makefile | | | 44 | ++++++++++++++++++++------------------------ |
A | config.mk | | | 12 | ++++++++++++ |
2 files changed, 32 insertions(+), 24 deletions(-)
diff --git a/Makefile b/Makefile @@ -1,35 +1,31 @@ -.POSIX: +include config.mk -PREFIX = /usr/local -MANDIR = $(PREFIX)/share/man/man1 +SRC = usynth.c fm.c machine.c midi.c operator.c wavetable.c +OBJ = ${SRC:.c=.o} -BIN = usynth -MAN = $(BIN).1 -OBJ = $(BIN:=.o) fm.o midi.o\ - machine.o operator.o wavetable.o +all: usynth -LDFLAGS=-lsndio -lm - -all: $(BIN) +.c.o: + ${CC} -c ${CFLAGS} $< -$(BIN): $(OBJ) - $(CC) $(OBJ) $(LDFLAGS) $(LIBS) -o $@ +${OBJ}: -$(OBJ): fm.h midi.h operator.h wavetable.h +usynth: ${OBJ} + ${CC} -o $@ ${OBJ} ${LDFLAGS} -install: $(BIN) - mkdir -p $(DESTDIR)$(PREFIX)/bin/ - cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin/ - chmod 555 $(DESTDIR)$(PREFIX)/bin/$(BIN) - mkdir -p $(DESTDIR)$(MANDIR) - cp -f $(MAN) $(DESTDIR)$(MANDIR) +install: all + mkdir -p ${DESTDIR}${PREFIX}/bin/ + cp -f usynth $(DESTDIR)${PREFIX}/bin/ + chmod 755 ${DESTDIR}${PREFIX}/bin/pcmprint + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + cp -f usynth.1 ${DESTDIR}${MANPREFIX}/man1/pcmprint.1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/pcmprint.1 uninstall: - rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN) - rm -f $(DESTDIR)$(MANDIR)/$(MAN) + rm -f ${DESTDIR}${PREFIX}/bin/usynth\ + ${DESTDIR}${MANDIR}/usynth.1 clean: - rm -f $(BIN) $(OBJ) + rm -f usynth ${OBJ} -.c.o: - $(CC) $(CFLAGS) -c $< +.PHONY: all clean instal uninstall diff --git a/config.mk b/config.mk @@ -0,0 +1,12 @@ +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man + +INCS = +LIBS = + +CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L +CFLAGS = -g -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS} +LDfLAGS = ${LIBS} + +CC = cc +