1
0
mirror of git://projects.qi-hardware.com/cae-tools.git synced 2025-04-21 12:27:27 +03:00

ptrude/: more comments; copyright headers; improved Makefile

This commit is contained in:
Werner Almesberger
2011-07-28 23:20:18 -03:00
parent dcb1c7856a
commit 188cf9d9d4
4 changed files with 117 additions and 9 deletions

View File

@@ -1,13 +1,66 @@
CFLAGS = -Wall -g
#
# Makefile - Makefile of ptrude
#
# Written 2011 by Werner Almesberger
# Copyright 2011 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.
#
SHELL = /bin/bash
MAIN = ptrude
OBJS = $(MAIN).o path.o
CFLAGS = -Wall -g -Wshadow -Wmissing-prototypes \
-Wmissing-declarations -Wno-format-zero-length
LDFLAGS = -lm
OBJS = ptrude.o path.o
.PHONY: clean try
# ----- Verbosity control -----------------------------------------------------
ptrude: $(OBJS)
CC_normal := $(CC)
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
try: ptrude
./ptrude <try | tee out
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: clean try
$(MAIN): $(OBJS)
try: $(MAIN)
./$(MAIN) <try | tee out
clean:
rm -f $(OBJS)
rm -f $(OBJS) $(OBJS:.o=.d)
spotless: clean
rm -f $(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)