1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2024-12-23 08:59:53 +02:00
cae-tools/cngt/Makefile
Werner Almesberger 62152e2987 cngt: some small fixes
- Makefile: updated program name in title comment
- cngt.c (do_key): "l" moved left, like "h"
- cngt.c (main): when starting, immediately move to initial position
- getkey.c (tty_open): open /dev/tty read-only, not write-only
2010-12-15 22:40:43 -03:00

78 lines
1.8 KiB
Makefile

#
# Makefile - Makefile of cngt
#
# Written 2010 by Werner Almesberger
# Copyright 2010 by Werner Almesberger
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
PREFIX ?= /usr/local
SHELL=/bin/bash
MAIN=cngt
OBJS=cngt.o getkey.o serial.o
CFLAGS_WARN=-Wall -Wshadow -Wmissing-prototypes \
-Wmissing-declarations -Wno-format-zero-length
CFLAGS=$(CFLAGS_WARN) -g
LDFLAGS=-lm
# ----- Verbosity control -----------------------------------------------------
CC_normal := $(CC)
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
CC_quiet = @echo " CC " $@ && $(CC_normal)
DEPEND_quiet = @$(DEPEND_normal)
ifeq ($(V),1)
CC = $(CC_normal)
DEPEND = $(DEPEND_normal)
else
CC = $(CC_quiet)
DEPEND = $(DEPEND_quiet)
endif
# ----- Rules -----------------------------------------------------------------
.PHONY: all clean spotless
all: $(MAIN)
$(MAIN): $(OBJS)
clean:
rm -f $(OBJS) $(OBJS:.o=.d)
spotless: clean
rm -f $(MAIN)
# ----- Install / uninstall ---------------------------------------------------
install: all
mkdir -p $(DESTDIR)/$(PREFIX)/bin/
install -m 755 $(MAIN) $(DESTDIR)/$(PREFIX)/bin/
uninstall:
rm -f $(DESTDIR)/$(PREFIX)/bin/$(MAIN)
# ----- Dependencies ----------------------------------------------------------
# compile and generate dependencies, from fped, based on
# http://scottmcpeak.com/autodepend/autodepend.html
%.o: %.c
$(CC) -c $(CFLAGS) $*.c -o $*.o
$(DEPEND) $*.c | \
sed -e \
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
-e '$${g;p;}' -e d >$*.d; \
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
-include $(OBJS:.o=.d)