2016-08-02 17:00:08 +03:00
|
|
|
#
|
|
|
|
# Makefile - build eeshow
|
|
|
|
#
|
|
|
|
# Written 2016 by Werner Almesberger
|
|
|
|
# Copyright 2016 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.
|
|
|
|
#
|
|
|
|
|
2016-08-21 07:25:49 +03:00
|
|
|
SHELL = /bin/bash
|
|
|
|
|
2016-08-02 17:00:08 +03:00
|
|
|
NAME = eeshow
|
2016-08-20 01:53:32 +03:00
|
|
|
OBJS = main.o version.o \
|
2016-08-18 03:15:44 +03:00
|
|
|
kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.o \
|
2016-08-22 07:10:55 +03:00
|
|
|
kicad/lib-render.o kicad/dwg.o kicad/delta.o kicad/sexpr.o \
|
2016-08-23 02:45:31 +03:00
|
|
|
kicad/pl-parse.o kicad/pl-render.o kicad/ext.o \
|
2016-08-18 07:45:24 +03:00
|
|
|
gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \
|
2016-08-18 18:41:12 +03:00
|
|
|
gui/progress.o gui/glabel.o gui/sheet.o gui/history.o gui/render.o \
|
2016-08-21 07:25:49 +03:00
|
|
|
gui/help.o gui/icons.o \
|
2016-08-18 03:07:13 +03:00
|
|
|
file/file.o file/git-util.o file/git-file.o file/git-hist.o \
|
2016-08-18 03:28:42 +03:00
|
|
|
gfx/style.o gfx/fig.o gfx/record.o gfx/cro.o gfx/diff.o gfx/gfx.o \
|
2016-08-21 17:34:12 +03:00
|
|
|
gfx/text.o gfx/misc.o gfx/pdftoc.o \
|
2016-08-18 03:37:15 +03:00
|
|
|
misc/diag.o
|
2016-08-02 17:00:08 +03:00
|
|
|
|
2016-08-21 07:25:49 +03:00
|
|
|
ICONS = delta diff
|
|
|
|
|
2016-08-02 17:00:08 +03:00
|
|
|
CFLAGS = -g -Wall -Wextra -Wno-unused-parameter -Wshadow \
|
|
|
|
-Wmissing-prototypes -Wmissing-declarations \
|
2016-08-18 02:54:25 +03:00
|
|
|
-I. \
|
2016-08-02 17:00:08 +03:00
|
|
|
`pkg-config --cflags cairo` \
|
2016-08-03 13:38:57 +03:00
|
|
|
`pkg-config --cflags libgit2` \
|
2016-08-19 23:35:41 +03:00
|
|
|
`pkg-config --cflags gtk+-3.0`
|
2016-08-02 17:00:08 +03:00
|
|
|
LDLIBS = -lm \
|
2016-08-03 13:38:57 +03:00
|
|
|
`pkg-config --libs cairo` \
|
|
|
|
`pkg-config --libs libgit2` \
|
2016-08-19 23:35:41 +03:00
|
|
|
`pkg-config --libs gtk+-3.0`
|
|
|
|
|
2016-08-20 01:53:32 +03:00
|
|
|
GIT_VERSION = $(shell git log -1 --format='%h' -s .)
|
|
|
|
GIT_STATUS = $(shell [ -z "`git status -s -uno`" ] || echo +)
|
|
|
|
CFLAGS += -DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"'
|
|
|
|
|
2016-08-19 23:35:41 +03:00
|
|
|
ifneq ($(USE_WEBKIT),)
|
|
|
|
CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0`
|
|
|
|
LDLIBS += `pkg-config --libs webkit2gtk-4.0`
|
|
|
|
HELP_TEXT = help.html
|
|
|
|
else
|
|
|
|
HELP_TEXT = help.txt
|
|
|
|
endif
|
2016-08-02 17:00:08 +03:00
|
|
|
|
|
|
|
include ../common/Makefile.c-common
|
|
|
|
|
2016-08-02 22:26:33 +03:00
|
|
|
.PHONY: test neo900 sch test testref png pngref pdf diff view newref
|
2016-08-02 17:00:08 +03:00
|
|
|
|
|
|
|
all:: $(NAME)
|
|
|
|
|
|
|
|
$(NAME): $(OBJS)
|
2016-08-20 13:40:56 +03:00
|
|
|
$(MAKE) -B version.o
|
2016-08-02 17:00:08 +03:00
|
|
|
$(CC) -o $(NAME) $(OBJS) $(LDLIBS)
|
|
|
|
|
2016-08-22 13:21:59 +03:00
|
|
|
#----- Help textx -------------------------------------------------------------
|
|
|
|
|
2016-08-19 23:35:41 +03:00
|
|
|
help.inc: $(HELP_TEXT) Makefile
|
|
|
|
$(BUILD) sed 's/"/\\"/g;s/.*/"&\\n"/' $< >$@ || \
|
|
|
|
{ rm -f $@; exit 1; }
|
2016-08-19 20:17:00 +03:00
|
|
|
|
|
|
|
gui/help.c: help.inc
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f help.inc
|
|
|
|
|
2016-08-22 13:21:59 +03:00
|
|
|
#----- Icons ------------------------------------------------------------------
|
|
|
|
|
2016-08-21 08:01:36 +03:00
|
|
|
icons/%.hex: icons/%.fig Makefile
|
|
|
|
$(BUILD) fig2dev -L png -S 4 -Z 0.60 $< | \
|
2016-08-21 07:25:49 +03:00
|
|
|
convert - -transparent white - | \
|
|
|
|
hexdump -v -e '/1 "0x%x, "' >$@; \
|
|
|
|
[ "$${PIPESTATUS[*]}" = "0 0 0" ] || { rm -f $@; exit 1; }
|
|
|
|
|
|
|
|
gui/icons.c: $(ICONS:%=icons/%.hex)
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f $(ICONS:%=icons/%.hex)
|
|
|
|
|
2016-08-02 17:00:08 +03:00
|
|
|
#----- Test sheet -------------------------------------------------------------
|
|
|
|
|
|
|
|
sch:
|
|
|
|
eeschema test.sch
|
|
|
|
|
|
|
|
test: $(NAME)
|
2016-08-06 03:16:56 +03:00
|
|
|
./$(NAME) test.lib test.sch -- fig >out.fig
|
2016-08-02 17:00:08 +03:00
|
|
|
fig2dev -L png -m 2 out.fig _out.png
|
|
|
|
[ ! -r ref.png ] || \
|
|
|
|
compare -metric AE ref.png _out.png _diff.png || \
|
|
|
|
qiv -t -R -D _diff.png ref.png _out.png
|
|
|
|
|
|
|
|
testref: $(NAME)
|
2016-08-06 03:16:56 +03:00
|
|
|
./$(NAME) test.lib test.sch -- fig | \
|
|
|
|
fig2dev -L png -m 2 >ref.png
|
2016-08-02 17:00:08 +03:00
|
|
|
|
|
|
|
png: $(NAME)
|
|
|
|
./$(NAME) test.lib test.sch -- png -o _out.png -s 2
|
|
|
|
[ ! -r pngref.png ] || \
|
|
|
|
compare -metric AE pngref.png _out.png _diff.png || \
|
|
|
|
qiv -t -R -D _diff.png pngref.png _out.png
|
|
|
|
|
|
|
|
pngref: $(NAME)
|
|
|
|
./$(NAME) test.lib test.sch -- png -o pngref.png -s 2
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f out.fig _out.png _diff.png
|
|
|
|
|
|
|
|
#----- Render Neo900 schematics -----------------------------------------------
|
|
|
|
|
|
|
|
NEO900_HW = ../../../n9/ee/hw
|
|
|
|
KICAD_LIBS = ../../kicad-libs/components
|
|
|
|
|
|
|
|
SHEET ?= 12
|
|
|
|
|
|
|
|
neo900: $(NAME)
|
|
|
|
./$(NAME) $(NEO900_HW)/neo900.lib \
|
|
|
|
$(KICAD_LIBS)/powered.lib \
|
|
|
|
$(NEO900_HW)/neo900_SS_$(SHEET).sch \
|
|
|
|
>out.fig
|
|
|
|
|
|
|
|
neo900.pdf: $(NAME) sch2pdf neo900-template.fig
|
|
|
|
./sch2pdf -o $@ -t neo900-template.fig \
|
|
|
|
$(NEO900_HW)/neo900.lib $(KICAD_LIBS)/powered.lib \
|
|
|
|
$(NEO900_HW)/neo900.sch
|
|
|
|
|
2016-08-02 22:26:33 +03:00
|
|
|
pdf: $(NAME)
|
2016-08-23 02:47:06 +03:00
|
|
|
./eeshow -r $(NEO900_HW)/neo900pageframe_A3.kicad_wks \
|
2016-08-22 13:20:39 +03:00
|
|
|
neo900.lib kicad-libs/components/powered.lib \
|
2016-08-02 22:26:33 +03:00
|
|
|
$(NEO900_HW)/neo900.sch -- pdf -o neo900.pdf
|
|
|
|
|
2016-08-02 17:00:08 +03:00
|
|
|
#----- Regression test based on Neo900 schematics -----------------------------
|
|
|
|
|
|
|
|
diff: $(NAME)
|
|
|
|
test/genpng test out
|
|
|
|
test/comp test || $(MAKE) view
|
|
|
|
|
|
|
|
view:
|
|
|
|
qiv -t -R -D `echo test/_diff*.png | \
|
|
|
|
sed 's/\([^ ]*\)_diff\([^ ]*\)/\1_diff\2 \1ref\2 \1out\2/g'`
|
|
|
|
|
|
|
|
newref:
|
|
|
|
test/genpng test ref
|