Root/
Source at commit 7081258910b767841129be93bff3c971d8db6cf1 created 7 years 2 months ago. By Erich Heinzle, diff for gEDA PCB export in fped | |
---|---|
1 | # |
2 | # Makefile - Makefile of fped, the footprint editor |
3 | # |
4 | # Written 2009-2012, 2015 by Werner Almesberger |
5 | # Copyright 2009-2012, 2015 by Werner Almesberger |
6 | # Copyright 2016, Erich Heinzle (gEDA additions) |
7 | # |
8 | # This program is free software; you can redistribute it and/or modify |
9 | # it under the terms of the GNU General Public License as published by |
10 | # the Free Software Foundation; either version 2 of the License, or |
11 | # (at your option) any later version. |
12 | # |
13 | |
14 | PREFIX ?= /usr/local |
15 | |
16 | UPLOAD = www-data@downloads.qi-hardware.com:werner/fped/ |
17 | |
18 | OBJS = fped.o expr.o coord.o obj.o delete.o inst.o util.o error.o \ |
19 | unparse.o file.o dump.o kicad.o geda.o postscript.o gnuplot.o meas.o \ |
20 | layer.o overlap.o hole.o tsort.o bitset.o \ |
21 | cpp.o lex.yy.o y.tab.o \ |
22 | gui.o gui_util.o gui_style.o gui_inst.o gui_status.o gui_canvas.o \ |
23 | gui_tool.o gui_over.o gui_meas.o gui_frame.o gui_frame_drag.o |
24 | |
25 | XPMS = point.xpm delete.xpm delete_off.xpm \ |
26 | vec.xpm frame.xpm \ |
27 | line.xpm rect.xpm pad.xpm rpad.xpm hole.xpm arc.xpm circ.xpm \ |
28 | meas.xpm meas_x.xpm meas_y.xpm \ |
29 | stuff.xpm stuff_off.xpm meas_off.xpm \ |
30 | bright.xpm bright_off.xpm all.xpm all_off.xpm |
31 | |
32 | PNGS = intro-1.png intro-2.png intro-3.png intro-4.png intro-5.png \ |
33 | intro-6.png concept-inst.png |
34 | |
35 | SHELL = /bin/bash |
36 | |
37 | CPPFLAGS += |
38 | CFLAGS_GTK = `pkg-config --cflags gtk+-2.0` |
39 | LIBS_GTK = `pkg-config --libs gtk+-2.0` |
40 | |
41 | CFLAGS_WARN = -Wall -Wshadow -Wmissing-prototypes \ |
42 | -Wmissing-declarations -Wno-format-zero-length |
43 | CFLAGS += -g -std=gnu99 $(CFLAGS_GTK) -DCPP='"cpp"' \ |
44 | -DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"' $(CFLAGS_WARN) |
45 | SLOPPY = -Wno-unused -Wno-implicit-function-declaration \ |
46 | -Wno-missing-prototypes -Wno-missing-declarations |
47 | LDFLAGS += |
48 | LDLIBS = -lm -lfl $(LIBS_GTK) |
49 | YACC = bison -y |
50 | YYFLAGS = -v |
51 | |
52 | GIT_VERSION:=$(shell git rev-parse HEAD | cut -c 1-7) |
53 | GIT_STATUS:=$(shell [ -z "`git status -s -uno`" ] || echo +) |
54 | |
55 | MKDEP = $(DEPEND) $(1).c | \ |
56 | sed -e \ |
57 | '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \ |
58 | -e '$${g;p;}' -e d >$(1).d; \ |
59 | [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $(1).d; exit 1; } |
60 | |
61 | |
62 | # ----- Verbosity control ----------------------------------------------------- |
63 | |
64 | CPP := $(CPP) # make sure changing CC won't affect CPP |
65 | |
66 | CC_normal := $(CC) |
67 | YACC_normal := $(YACC) |
68 | LEX_normal := $(LEX) |
69 | DEPEND_normal := $(CPP) $(CFLAGS) -MM -MG |
70 | |
71 | CC_quiet = @echo " CC " $@ && $(CC_normal) |
72 | YACC_quiet = @echo " YACC " $@ && $(YACC_normal) |
73 | LEX_quiet = @echo " LEX " $@ && $(LEX_normal) |
74 | GEN_quiet = @echo " GENERATE " $@ && |
75 | DEPEND_quiet = @$(DEPEND_normal) |
76 | |
77 | ifeq ($(V),1) |
78 | CC = $(CC_normal) |
79 | LEX = $(LEX_normal) |
80 | YACC = $(YACC_normal) |
81 | GEN = |
82 | DEPEND = $(DEPEND_normal) |
83 | else |
84 | CC = $(CC_quiet) |
85 | LEX = $(LEX_quiet) |
86 | YACC = $(YACC_quiet) |
87 | GEN = $(GEN_quiet) |
88 | DEPEND = $(DEPEND_quiet) |
89 | endif |
90 | |
91 | # ----- Rules ----------------------------------------------------------------- |
92 | |
93 | .PHONY: all dep depend clean spotless |
94 | .PHONY: install uninstall manual upload-manual man manps |
95 | .PHONY: montage test tests valgrind |
96 | |
97 | .SUFFIXES: .fig .xpm .ppm |
98 | |
99 | # compile and generate dependencies, based on |
100 | # http://scottmcpeak.com/autodepend/autodepend.html |
101 | |
102 | %.o: %.c |
103 | $(CC) $(CPPFLAGS) $(CFLAGS) -c $*.c -o $*.o |
104 | $(call MKDEP, $*) |
105 | |
106 | # generate 26x26 pixels icons, then drop the 1-pixel frame |
107 | |
108 | .fig.ppm: |
109 | $(GEN) fig2dev -L ppm -Z 0.32 -S 4 $< | \ |
110 | convert -crop 24x24+1+1 - - >$@; \ |
111 | [ "$${PIPESTATUS[*]}" = "0 0" ] || { rm -f $@; exit 1; } |
112 | |
113 | # ppmtoxpm is very chatty, so we suppress its stderr |
114 | |
115 | .ppm.xpm: |
116 | $(GEN) export TMP=_tmp$$$$; ppmcolormask white $< >$$TMP && \ |
117 | ppmtoxpm -name xpm_`basename $@ .xpm` -alphamask $$TMP \ |
118 | $< >$@ 2>/dev/null && rm -f $$TMP || \ |
119 | { rm -f $@ $$TMP; exit 1; } |
120 | |
121 | all: fped |
122 | |
123 | fped: $(OBJS) |
124 | $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) |
125 | |
126 | lex.yy.c: fpd.l y.tab.h |
127 | $(LEX) fpd.l |
128 | |
129 | lex.yy.o: lex.yy.c y.tab.h |
130 | $(CC) -c $(CFLAGS) $(SLOPPY) lex.yy.c |
131 | $(call MKDEP, lex.yy) |
132 | |
133 | y.tab.c y.tab.h: fpd.y |
134 | $(YACC) $(YYFLAGS) -d fpd.y |
135 | |
136 | y.tab.o: y.tab.c |
137 | $(CC) -c $(CFLAGS) $(SLOPPY) y.tab.c |
138 | $(call MKDEP, y.tab) |
139 | |
140 | gui_tool.o gui.o: $(XPMS:%=icons/%) |
141 | |
142 | # ----- Upload the GUI manual ------------------------------------------------- |
143 | |
144 | manual: $(XPMS:%=icons/%) |
145 | for n in $(XPMS:%.xpm=%); do \ |
146 | convert icons/$$n.xpm manual/$$n.png || exit 1; done |
147 | fig2dev -L png -S 4 manual/concept-inst.fig \ |
148 | >manual/concept-inst.png |
149 | |
150 | upload-manual: manual |
151 | scp gui.html README $(UPLOAD)/ |
152 | scp $(XPMS:%.xpm=manual/%.png) $(PNGS:%=manual/%) \ |
153 | $(UPLOAD)/manual/ |
154 | |
155 | # ---- Format the man page ---------------------------------------------------- |
156 | |
157 | man: |
158 | # less is for converting overstriking to bold |
159 | groff -Tascii -mandoc fped.1 | less |
160 | |
161 | manps: |
162 | groff -Tps -mandoc fped.1 | gv - |
163 | |
164 | # ----- Debugging help -------------------------------------------------------- |
165 | |
166 | montage: |
167 | montage -label %f -frame 3 __dbg????.png png:- | display - |
168 | |
169 | # ----- Dependencies ---------------------------------------------------------- |
170 | |
171 | dep depend .depend: |
172 | @echo 'no need to run "make depend" anymore' 1>&2 |
173 | |
174 | -include $(OBJS:.o=.d) |
175 | |
176 | # ----- Tests ----------------------------------------------------------------- |
177 | |
178 | test tests: all |
179 | LANG= sh -c \ |
180 | 'passed=0 && cd test && \ |
181 | for n in [a-z]*; do \ |
182 | [ $$n != core ] && SCRIPT=$$n CWD_PREFIX=.. . ./$$n; done; \ |
183 | echo "Passed all $$passed tests"' |
184 | |
185 | valgrind: |
186 | VALGRIND="valgrind -q" $(MAKE) tests |
187 | |
188 | # ----- Cleanup --------------------------------------------------------------- |
189 | |
190 | clean: |
191 | rm -f $(OBJS) $(XPMS:%=icons/%) $(XPMS:%.xpm=icons/%.ppm) |
192 | rm -f lex.yy.c y.tab.c y.tab.h y.output .depend $(OBJS:.o=.d) |
193 | rm -f __dbg????.png _tmp* test/core |
194 | |
195 | spotless: clean |
196 | rm -f fped |
197 | |
198 | # ----- Install / uninstall --------------------------------------------------- |
199 | |
200 | install: all |
201 | mkdir -p $(DESTDIR)/$(PREFIX)/bin/ |
202 | install -m 755 fped $(DESTDIR)/$(PREFIX)/bin/ |
203 | |
204 | uninstall: |
205 | rm -f $(DESTDIR)/$(PREFIX)/bin/fped |
206 |
Branches:
master