Root/eeshow/Makefile

Source at commit 1b250bd46737db7133fe9314be6baa3edab3d5c7 created 7 years 6 months ago.
By Werner Almesberger, eeshow/: change file name handling from positional to be extension-driven
1#
2# Makefile - build eeshow
3#
4# Written 2016 by Werner Almesberger
5# Copyright 2016 by Werner Almesberger
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12
13SHELL = /bin/bash
14
15NAME = eeshow
16OBJS = main.o version.o \
17       kicad/sch-parse.o kicad/sch-render.o kicad/lib-parse.o \
18       kicad/lib-render.o kicad/dwg.o kicad/delta.o kicad/sexpr.o \
19       kicad/pl-parse.o kicad/pl-render.o kicad/ext.o \
20       gui/gui.o gui/over.o gui/style.o gui/aoi.o gui/fmt-pango.o gui/input.o \
21       gui/progress.o gui/glabel.o gui/sheet.o gui/history.o gui/render.o \
22       gui/help.o gui/icons.o \
23       file/file.o file/git-util.o file/git-file.o file/git-hist.o \
24       gfx/style.o gfx/fig.o gfx/record.o gfx/cro.o gfx/diff.o gfx/gfx.o \
25       gfx/text.o gfx/misc.o gfx/pdftoc.o \
26       misc/diag.o
27
28ICONS = delta diff
29
30CFLAGS = -g -Wall -Wextra -Wno-unused-parameter -Wshadow \
31     -Wmissing-prototypes -Wmissing-declarations \
32     -I. \
33     `pkg-config --cflags cairo` \
34     `pkg-config --cflags libgit2` \
35     `pkg-config --cflags gtk+-3.0`
36LDLIBS = -lm \
37     `pkg-config --libs cairo` \
38     `pkg-config --libs libgit2` \
39     `pkg-config --libs gtk+-3.0`
40
41GIT_VERSION = $(shell git log -1 --format='%h' -s .)
42GIT_STATUS = $(shell [ -z "`git status -s -uno`" ] || echo +)
43CFLAGS += -DVERSION='"$(GIT_VERSION)$(GIT_STATUS)"'
44
45ifneq ($(USE_WEBKIT),)
46    CFLAGS += -DUSE_WEBKIT `pkg-config --cflags webkit2gtk-4.0`
47    LDLIBS += `pkg-config --libs webkit2gtk-4.0`
48    HELP_TEXT = help.html
49else
50    HELP_TEXT = help.txt
51endif
52
53include ../common/Makefile.c-common
54
55.PHONY: test neo900 sch test testref png pngref pdf diff view newref
56
57all:: $(NAME)
58
59$(NAME): $(OBJS)
60        $(MAKE) -B version.o
61        $(CC) -o $(NAME) $(OBJS) $(LDLIBS)
62
63#----- Help textx -------------------------------------------------------------
64
65help.inc: $(HELP_TEXT) Makefile
66        $(BUILD) sed 's/"/\\"/g;s/.*/"&\\n"/' $< >$@ || \
67            { rm -f $@; exit 1; }
68
69gui/help.c: help.inc
70
71clean::
72        rm -f help.inc
73
74#----- Icons ------------------------------------------------------------------
75
76icons/%.hex: icons/%.fig Makefile
77        $(BUILD) fig2dev -L png -S 4 -Z 0.60 $< | \
78            convert - -transparent white - | \
79            hexdump -v -e '/1 "0x%x, "' >$@; \
80            [ "$${PIPESTATUS[*]}" = "0 0 0" ] || { rm -f $@; exit 1; }
81
82gui/icons.c: $(ICONS:%=icons/%.hex)
83
84clean::
85        rm -f $(ICONS:%=icons/%.hex)
86
87#----- Test sheet -------------------------------------------------------------
88
89sch:
90        eeschema test.sch
91
92test: $(NAME)
93        ./$(NAME) test.lib test.sch -- fig >out.fig
94        fig2dev -L png -m 2 out.fig _out.png
95        [ ! -r ref.png ] || \
96            compare -metric AE ref.png _out.png _diff.png || \
97            qiv -t -R -D _diff.png ref.png _out.png
98
99testref: $(NAME)
100        ./$(NAME) test.lib test.sch -- fig | \
101            fig2dev -L png -m 2 >ref.png
102
103png: $(NAME)
104        ./$(NAME) test.lib test.sch -- png -o _out.png -s 2
105        [ ! -r pngref.png ] || \
106            compare -metric AE pngref.png _out.png _diff.png || \
107            qiv -t -R -D _diff.png pngref.png _out.png
108
109pngref: $(NAME)
110        ./$(NAME) test.lib test.sch -- png -o pngref.png -s 2
111
112clean::
113        rm -f out.fig _out.png _diff.png
114
115#----- Render Neo900 schematics -----------------------------------------------
116
117NEO900_HW = ../../../n9/ee/hw
118KICAD_LIBS = ../../kicad-libs/components
119
120SHEET ?= 12
121
122neo900: $(NAME)
123        ./$(NAME) $(NEO900_HW)/neo900.lib \
124            $(KICAD_LIBS)/powered.lib \
125            $(NEO900_HW)/neo900_SS_$(SHEET).sch \
126            >out.fig
127
128neo900.pdf: $(NAME) sch2pdf neo900-template.fig
129        ./sch2pdf -o $@ -t neo900-template.fig \
130            $(NEO900_HW)/neo900.lib $(KICAD_LIBS)/powered.lib \
131            $(NEO900_HW)/neo900.sch
132
133pdf: $(NAME)
134        ./eeshow -r $(NEO900_HW)/neo900pageframe_A3.kicad_wks \
135            neo900.lib kicad-libs/components/powered.lib \
136            $(NEO900_HW)/neo900.sch -- pdf -o neo900.pdf
137
138#----- Regression test based on Neo900 schematics -----------------------------
139
140diff: $(NAME)
141        test/genpng test out
142        test/comp test || $(MAKE) view
143
144view:
145        qiv -t -R -D `echo test/_diff*.png | \
146            sed 's/\([^ ]*\)_diff\([^ ]*\)/\1_diff\2 \1ref\2 \1out\2/g'`
147
148newref:
149        test/genpng test ref
150

Archive Download this file

Branches:
master



interactive