2009-08-03 19:12:47 +03:00
|
|
|
#
|
|
|
|
# Makefile - Makefile of fped, the footprint editor
|
|
|
|
#
|
2016-03-22 00:58:28 +02:00
|
|
|
# Written 2009-2012, 2015 by Werner Almesberger
|
|
|
|
# Copyright 2009-2012, 2015 by Werner Almesberger
|
2017-01-22 15:39:07 +02:00
|
|
|
# Copyright 2016, Erich Heinzle (gEDA additions)
|
2009-08-03 19:12:47 +03:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2010-10-12 18:45:09 +03:00
|
|
|
PREFIX ?= /usr/local
|
2009-08-16 02:25:05 +03:00
|
|
|
|
2011-07-28 12:37:08 +03:00
|
|
|
UPLOAD = www-data@downloads.qi-hardware.com:werner/fped/
|
2009-08-23 01:55:39 +03:00
|
|
|
|
2009-08-05 03:32:38 +03:00
|
|
|
OBJS = fped.o expr.o coord.o obj.o delete.o inst.o util.o error.o \
|
2017-01-22 15:39:07 +02:00
|
|
|
unparse.o file.o dump.o kicad.o geda.o postscript.o gnuplot.o meas.o \
|
The mechanism for selecting points for measurements reaches its limits when
using frames to encapsulate building blocks, e.g., like macros or functions in
a programming language. Since measurements only know about the frame containing
a vector but not the frames containing that frame, invocations of this frame
from different places can only be distinguished within the min/next/max scheme.
(See the example in README.)
To eliminate this limitation, one needs a way to tell fped to consider a point
only if it has been instantiated through a certain path, e.g., by requiring
some other frames to be visited in its instantiation. This increases the number
of distinct points available for measurements.
The mechanism chosen is to qualify a measurement point with frames that lead to
it. This list of outer frames does not have to include all frames. Without
qualifying, the old behaviour results.
Note that this doesn't cover all possible ways in which a point can appear in
different roles. Multiple frame references can also result from repeating the
same frame reference in the same parent frame. The current qualification
mechanism does not allow such paths to be distinguished. However, one can
always introduce intermediate frames for this purpose.
Furthermore, repetitions create multiple instances of a point, although in what
should be considered the same role.
- fpd.l: make scanner support free-format a little better by switching back to
keyword mode after frame braces. This way, one can write a simple frame in a
single line, which is useful for regression tests.
- fpd.l, fpd.y, README, test/dbg_meas: added %meas directive to print the
result of a measurement
- fpd.y, README: measurements can now be labeled. Note that, due to limitations
of the grammar, the first measurement cannot be labeled.
- error.h, error.c (yywarn): new function for non-fatal diagnostics that always
get reported to standard error
- bitset.h, bitset.c: functions to manipulate variable-size bit sets
- meas.h, fpd.y, README, test/meas_qual: added the means to specify qualifiers
for points used in measurements
- dump.c (print_meas_base, print_meas): dump qualifiers
- delete.c (delete_references, test/del_frame): delete measurements that
reference a frame being deleted in their qualifiers
- obj.h, obj.c (enumerate_frames, instantiate): enumerate all frames so that we
have an index into the bit vector of visited frames
- meas.h, meas.c (reset_samples, meas_post), obj.c (generate_vecs,
generate_frame, instantiate): record the set of frames visited for each
sample
- meas.c (meas_post): only treat two instances of a point as equivalent if the
set of frames visited of one of them is a superset of set of the other. In
this case, keep the union of the two sets.
- meas.h, meas.c (meas_find_min, meas_find_next, meas_find_max),
test/meas_qual: instantiate_meas_pkg only select points for which all frames
in the qualification have been visited
- gui_meas.c (is_min, is_next, is_max, is_a_next): updated for above change
- inst.h, inst.c (curr_frame, propagate_bbox, add_inst, inst_begin_frame,
inst_end_frame, inst_start): renamed curr_frame to frame_instantiating to
avoid clash with curr_frame in fpd.y
- inst.h, inst.c (find_meas_hint): make global
- test/structure, test/del_vec, test/del_frame: fped now warns if a measurement
is in an unlinked frame. Changed regressions tests to avoid this warning.
- test/Common: new function expect_grep to compare only part of the output
git-svn-id: http://svn.openmoko.org/trunk/eda/fped@5967 99fdad57-331a-0410-800a-d7fa5415bdb3
2010-05-30 00:13:48 +03:00
|
|
|
layer.o overlap.o hole.o tsort.o bitset.o \
|
2009-08-03 19:12:47 +03:00
|
|
|
cpp.o lex.yy.o y.tab.o \
|
|
|
|
gui.o gui_util.o gui_style.o gui_inst.o gui_status.o gui_canvas.o \
|
2010-04-23 16:43:19 +03:00
|
|
|
gui_tool.o gui_over.o gui_meas.o gui_frame.o gui_frame_drag.o
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-14 13:18:40 +03:00
|
|
|
XPMS = point.xpm delete.xpm delete_off.xpm \
|
2010-04-25 03:11:45 +03:00
|
|
|
vec.xpm frame.xpm \
|
2010-04-25 13:58:07 +03:00
|
|
|
line.xpm rect.xpm pad.xpm rpad.xpm hole.xpm arc.xpm circ.xpm \
|
2009-08-14 13:18:40 +03:00
|
|
|
meas.xpm meas_x.xpm meas_y.xpm \
|
2009-08-22 22:00:55 +03:00
|
|
|
stuff.xpm stuff_off.xpm meas_off.xpm \
|
|
|
|
bright.xpm bright_off.xpm all.xpm all_off.xpm
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-10-19 18:00:30 +03:00
|
|
|
PNGS = intro-1.png intro-2.png intro-3.png intro-4.png intro-5.png \
|
|
|
|
intro-6.png concept-inst.png
|
2009-08-23 01:55:39 +03:00
|
|
|
|
2009-08-19 17:38:59 +03:00
|
|
|
SHELL = /bin/bash
|
2012-10-08 07:12:38 +03:00
|
|
|
|
|
|
|
CPPFLAGS +=
|
2009-08-03 19:12:47 +03:00
|
|
|
CFLAGS_GTK = `pkg-config --cflags gtk+-2.0`
|
|
|
|
LIBS_GTK = `pkg-config --libs gtk+-2.0`
|
|
|
|
|
2009-08-19 17:38:59 +03:00
|
|
|
CFLAGS_WARN = -Wall -Wshadow -Wmissing-prototypes \
|
|
|
|
-Wmissing-declarations -Wno-format-zero-length
|
2012-10-08 07:12:38 +03:00
|
|
|
CFLAGS += -g -std=gnu99 $(CFLAGS_GTK) -DCPP='"cpp"' \
|
2011-07-28 12:29:19 +03:00
|
|
|
-DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"' $(CFLAGS_WARN)
|
2009-08-19 17:38:59 +03:00
|
|
|
SLOPPY = -Wno-unused -Wno-implicit-function-declaration \
|
|
|
|
-Wno-missing-prototypes -Wno-missing-declarations
|
2012-10-08 07:12:38 +03:00
|
|
|
LDFLAGS +=
|
2009-08-03 19:12:47 +03:00
|
|
|
LDLIBS = -lm -lfl $(LIBS_GTK)
|
2009-08-19 17:38:59 +03:00
|
|
|
YACC = bison -y
|
|
|
|
YYFLAGS = -v
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2011-07-28 12:29:19 +03:00
|
|
|
GIT_VERSION:=$(shell git rev-parse HEAD | cut -c 1-7)
|
|
|
|
GIT_STATUS:=$(shell [ -z "`git status -s -uno`" ] || echo +)
|
2010-02-18 16:03:14 +02:00
|
|
|
|
2012-05-22 22:20:54 +03:00
|
|
|
MKDEP = $(DEPEND) $(1).c | \
|
|
|
|
sed -e \
|
|
|
|
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
|
|
|
|
-e '$${g;p;}' -e d >$(1).d; \
|
|
|
|
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $(1).d; exit 1; }
|
|
|
|
|
2010-02-18 16:03:14 +02:00
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
# ----- Verbosity control -----------------------------------------------------
|
|
|
|
|
|
|
|
CPP := $(CPP) # make sure changing CC won't affect CPP
|
|
|
|
|
|
|
|
CC_normal := $(CC)
|
|
|
|
YACC_normal := $(YACC)
|
|
|
|
LEX_normal := $(LEX)
|
2010-02-20 07:10:24 +02:00
|
|
|
DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
CC_quiet = @echo " CC " $@ && $(CC_normal)
|
|
|
|
YACC_quiet = @echo " YACC " $@ && $(YACC_normal)
|
|
|
|
LEX_quiet = @echo " LEX " $@ && $(LEX_normal)
|
|
|
|
GEN_quiet = @echo " GENERATE " $@ &&
|
2010-02-20 07:10:24 +02:00
|
|
|
DEPEND_quiet = @$(DEPEND_normal)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
ifeq ($(V),1)
|
|
|
|
CC = $(CC_normal)
|
|
|
|
LEX = $(LEX_normal)
|
|
|
|
YACC = $(YACC_normal)
|
|
|
|
GEN =
|
|
|
|
DEPEND = $(DEPEND_normal)
|
|
|
|
else
|
|
|
|
CC = $(CC_quiet)
|
|
|
|
LEX = $(LEX_quiet)
|
|
|
|
YACC = $(YACC_quiet)
|
|
|
|
GEN = $(GEN_quiet)
|
|
|
|
DEPEND = $(DEPEND_quiet)
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ----- Rules -----------------------------------------------------------------
|
|
|
|
|
2010-10-12 18:39:32 +03:00
|
|
|
.PHONY: all dep depend clean spotless
|
2016-03-22 02:57:28 +02:00
|
|
|
.PHONY: install uninstall manual upload-manual man manps
|
2011-07-28 12:40:13 +03:00
|
|
|
.PHONY: montage test tests valgrind
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-12-16 19:25:13 +02:00
|
|
|
.SUFFIXES: .fig .xpm .ppm
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2010-02-20 07:10:24 +02:00
|
|
|
# compile and generate dependencies, based on
|
|
|
|
# http://scottmcpeak.com/autodepend/autodepend.html
|
|
|
|
|
|
|
|
%.o: %.c
|
2012-10-08 07:12:38 +03:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c -o $*.o
|
2012-05-22 22:20:54 +03:00
|
|
|
$(call MKDEP, $*)
|
2010-10-12 18:39:32 +03:00
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
# generate 26x26 pixels icons, then drop the 1-pixel frame
|
|
|
|
|
2009-12-16 19:25:13 +02:00
|
|
|
.fig.ppm:
|
|
|
|
$(GEN) fig2dev -L ppm -Z 0.32 -S 4 $< | \
|
|
|
|
convert -crop 24x24+1+1 - - >$@; \
|
|
|
|
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $@; exit 1; }
|
|
|
|
|
|
|
|
# ppmtoxpm is very chatty, so we suppress its stderr
|
|
|
|
|
|
|
|
.ppm.xpm:
|
2010-01-02 14:55:34 +02:00
|
|
|
$(GEN) export TMP=_tmp$$$$; ppmcolormask white $< >$$TMP && \
|
|
|
|
ppmtoxpm -name xpm_`basename $@ .xpm` -alphamask $$TMP \
|
|
|
|
$< >$@ 2>/dev/null && rm -f $$TMP || \
|
|
|
|
{ rm -f $@ $$TMP; exit 1; }
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
all: fped
|
|
|
|
|
|
|
|
fped: $(OBJS)
|
2010-10-16 16:52:50 +03:00
|
|
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
lex.yy.c: fpd.l y.tab.h
|
|
|
|
$(LEX) fpd.l
|
|
|
|
|
|
|
|
lex.yy.o: lex.yy.c y.tab.h
|
|
|
|
$(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c
|
2012-05-22 22:20:54 +03:00
|
|
|
$(call MKDEP, lex.yy)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
|
|
|
y.tab.c y.tab.h: fpd.y
|
|
|
|
$(YACC) $(YYFLAGS) -d fpd.y
|
|
|
|
|
|
|
|
y.tab.o: y.tab.c
|
|
|
|
$(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c
|
2012-05-22 22:20:54 +03:00
|
|
|
$(call MKDEP, y.tab)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-09 00:59:33 +03:00
|
|
|
gui_tool.o gui.o: $(XPMS:%=icons/%)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2009-08-23 01:55:39 +03:00
|
|
|
# ----- Upload the GUI manual -------------------------------------------------
|
|
|
|
|
2009-09-13 16:16:39 +03:00
|
|
|
manual: $(XPMS:%=icons/%)
|
2009-08-24 19:53:47 +03:00
|
|
|
for n in $(XPMS:%.xpm=%); do \
|
|
|
|
convert icons/$$n.xpm manual/$$n.png || exit 1; done
|
2009-09-13 16:16:39 +03:00
|
|
|
fig2dev -L png -S 4 manual/concept-inst.fig \
|
|
|
|
>manual/concept-inst.png
|
|
|
|
|
|
|
|
upload-manual: manual
|
|
|
|
scp gui.html README $(UPLOAD)/
|
2009-08-24 19:53:47 +03:00
|
|
|
scp $(XPMS:%.xpm=manual/%.png) $(PNGS:%=manual/%) \
|
|
|
|
$(UPLOAD)/manual/
|
2009-08-23 01:55:39 +03:00
|
|
|
|
2016-03-22 00:58:28 +02:00
|
|
|
# ---- Format the man page ----------------------------------------------------
|
|
|
|
|
|
|
|
man:
|
|
|
|
# less is for converting overstriking to bold
|
|
|
|
groff -Tascii -mandoc fped.1 | less
|
|
|
|
|
2016-03-22 02:57:28 +02:00
|
|
|
manps:
|
|
|
|
groff -Tps -mandoc fped.1 | gv -
|
|
|
|
|
2010-01-02 14:55:34 +02:00
|
|
|
# ----- Debugging help --------------------------------------------------------
|
|
|
|
|
|
|
|
montage:
|
|
|
|
montage -label %f -frame 3 __dbg????.png png:- | display -
|
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
# ----- Dependencies ----------------------------------------------------------
|
|
|
|
|
2010-02-20 07:10:24 +02:00
|
|
|
dep depend .depend:
|
|
|
|
@echo 'no need to run "make depend" anymore' 1>&2
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2010-02-20 07:10:24 +02:00
|
|
|
-include $(OBJS:.o=.d)
|
2009-08-03 19:12:47 +03:00
|
|
|
|
2010-04-27 00:30:21 +03:00
|
|
|
# ----- Tests -----------------------------------------------------------------
|
|
|
|
|
|
|
|
test tests: all
|
|
|
|
LANG= sh -c \
|
|
|
|
'passed=0 && cd test && \
|
|
|
|
for n in [a-z]*; do \
|
2010-10-12 18:32:15 +03:00
|
|
|
[ $$n != core ] && SCRIPT=$$n CWD_PREFIX=.. . ./$$n; done; \
|
2010-04-27 00:30:21 +03:00
|
|
|
echo "Passed all $$passed tests"'
|
|
|
|
|
|
|
|
valgrind:
|
|
|
|
VALGRIND="valgrind -q" $(MAKE) tests
|
|
|
|
|
2009-08-03 19:12:47 +03:00
|
|
|
# ----- Cleanup ---------------------------------------------------------------
|
|
|
|
|
2009-08-16 02:25:05 +03:00
|
|
|
clean:
|
2009-12-16 19:25:13 +02:00
|
|
|
rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm)
|
2010-02-20 07:10:24 +02:00
|
|
|
rm -f lex.yy.c y.tab.c y.tab.h y.output .depend $(OBJS:.o=.d)
|
2010-10-12 18:32:15 +03:00
|
|
|
rm -f __dbg????.png _tmp* test/core
|
2009-08-16 02:25:05 +03:00
|
|
|
|
2010-10-12 18:39:32 +03:00
|
|
|
spotless: clean
|
|
|
|
rm -f fped
|
|
|
|
|
2009-08-16 02:25:05 +03:00
|
|
|
# ----- Install / uninstall ---------------------------------------------------
|
|
|
|
|
2009-08-22 18:58:58 +03:00
|
|
|
install: all
|
2010-10-12 18:45:09 +03:00
|
|
|
mkdir -p $(DESTDIR)/$(PREFIX)/bin/
|
|
|
|
install -m 755 fped $(DESTDIR)/$(PREFIX)/bin/
|
2009-08-16 02:25:05 +03:00
|
|
|
|
|
|
|
uninstall:
|
2010-10-12 18:45:09 +03:00
|
|
|
rm -f $(DESTDIR)/$(PREFIX)/bin/fped
|