2009-08-03 19:12:47 +03:00
|
|
|
#
|
|
|
|
# Makefile - Makefile of fped, the footprint editor
|
|
|
|
#
|
2010-01-02 14:55:34 +02:00
|
|
|
# Written 2009, 2010 by Werner Almesberger
|
|
|
|
# Copyright 2009, 2010 by Werner Almesberger
|
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.
|
|
|
|
#
|
|
|
|
|
2009-08-16 02:25:05 +03:00
|
|
|
PREFIX = /usr/local
|
|
|
|
|
2009-08-23 01:55:39 +03:00
|
|
|
UPLOAD = werner@sita.openmoko.org:public_html/fped/
|
|
|
|
|
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 \
|
2009-08-11 23:17:39 +03:00
|
|
|
unparse.o file.o dump.o kicad.o postscript.o meas.o \
|
2009-09-13 12:58:30 +03:00
|
|
|
layer.o overlap.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 \
|
2009-08-08 22:44:17 +03:00
|
|
|
gui_tool.o gui_over.o gui_meas.o gui_frame.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 \
|
|
|
|
vec.xpm frame.xpm frame_locked.xpm frame_ready.xpm \
|
2009-12-15 23:24:30 +02:00
|
|
|
line.xpm rect.xpm pad.xpm rpad.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
|
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
|
2010-02-18 16:03:14 +02:00
|
|
|
CFLAGS = -g -std=gnu99 $(CFLAGS_GTK) -DCPP='"cpp"' \
|
|
|
|
-DSVN_VERSION='"$(SVN_VERSION)$(SVN_STATUS)"' $(CFLAGS_WARN)
|
2009-08-19 17:38:59 +03:00
|
|
|
SLOPPY = -Wno-unused -Wno-implicit-function-declaration \
|
|
|
|
-Wno-missing-prototypes -Wno-missing-declarations
|
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
|
|
|
|
2010-02-18 16:18:30 +02:00
|
|
|
SVN_VERSION=$(shell svn info -R | sed '/Last Changed Rev: /s///p;d' | \
|
|
|
|
sort -r | sed 1q)
|
2010-02-18 16:03:14 +02:00
|
|
|
SVN_STATUS=$(shell [ -z "`svn status -q`" ] || echo +)
|
|
|
|
|
|
|
|
|
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 -----------------------------------------------------------------
|
|
|
|
|
2009-09-13 16:16:39 +03:00
|
|
|
.PHONY: all dep depend clean install uninstall manual upload-manual
|
2010-01-02 14:55:34 +02:00
|
|
|
.PHONY: update montage
|
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
|
|
|
|
$(CC) -c $(CFLAGS) $*.c -o $*.o
|
2010-02-23 03:02:19 +02:00
|
|
|
$(DEPEND) $*.c | \
|
2010-02-20 07:10:24 +02:00
|
|
|
sed -e \
|
|
|
|
'/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
|
|
|
|
-e '$${g;p;}' -e d >$*.d; \
|
|
|
|
[ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $*.d; exit 1; }
|
|
|
|
|
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)
|
|
|
|
$(CC) -o $@ $(OBJS) $(LDLIBS)
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
|
|
# ----- 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-01-02 14:55:34 +02:00
|
|
|
rm -f __dbg????.png _tmp*
|
2009-08-16 02:25:05 +03:00
|
|
|
|
|
|
|
# ----- Install / uninstall ---------------------------------------------------
|
|
|
|
|
2009-08-22 18:58:58 +03:00
|
|
|
install: all
|
2009-08-16 02:25:05 +03:00
|
|
|
install -m 755 fped $(PREFIX)/bin/
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm -f $(PREFIX)/bin/fped
|
2009-09-12 10:34:02 +03:00
|
|
|
|
|
|
|
# ----- SVN update ------------------------------------------------------------
|
|
|
|
|
|
|
|
update:
|
|
|
|
svn update
|
|
|
|
$(MAKE) dep all
|