Makefile: add special target .DELETE_ON_ERROR
[fw/openocd] / Makefile.am
1 # not a GNU package. You can remove this line, if
2 # have all needed files, that a GNU package needs
3 AUTOMAKE_OPTIONS = gnu 1.6
4
5 .DELETE_ON_ERROR:
6
7 # make sure we pass the correct jimtcl flags to distcheck
8 DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim
9
10 # do not run Jim Tcl tests (esp. during distcheck)
11 check-recursive: SUBDIRS :=
12
13 nobase_dist_pkgdata_DATA = \
14         contrib/libdcc/dcc_stdio.c \
15         contrib/libdcc/dcc_stdio.h \
16         contrib/libdcc/example.c \
17         contrib/libdcc/README \
18         contrib/60-openocd.rules
19
20 SUBDIRS =
21 DIST_SUBDIRS =
22 bin_PROGRAMS =
23 noinst_LTLIBRARIES =
24 info_TEXINFOS =
25 dist_man_MANS =
26 EXTRA_DIST =
27
28 if INTERNAL_JIMTCL
29 SUBDIRS += jimtcl
30 DIST_SUBDIRS += jimtcl
31 endif
32
33 # common flags used in openocd build
34 AM_CFLAGS = $(GCC_WARNINGS)
35
36 AM_CPPFLAGS = $(HOST_CPPFLAGS)\
37                           -I$(top_srcdir)/src \
38                           -I$(top_builddir)/src \
39                           -I$(top_srcdir)/src/helper \
40                           -DPKGDATADIR=\"$(pkgdatadir)\" \
41                           -DBINDIR=\"$(bindir)\"
42
43 if INTERNAL_JIMTCL
44 AM_CPPFLAGS += -I$(top_srcdir)/jimtcl \
45                            -I$(top_builddir)/jimtcl
46 endif
47 EXTRA_DIST += \
48         BUGS \
49         HACKING \
50         NEWTAPS \
51         README.Windows \
52         README.macOS \
53         $(EXTRA_DIST_NEWS) \
54         Doxyfile.in \
55         LICENSES/license-rules.txt \
56         LICENSES/preferred/BSD-1-Clause \
57         LICENSES/preferred/BSD-2-Clause \
58         LICENSES/preferred/BSD-3-Clause \
59         LICENSES/preferred/GFDL-1.2 \
60         LICENSES/preferred/gfdl-1.2.texi.readme \
61         LICENSES/preferred/GPL-2.0 \
62         LICENSES/preferred/MIT \
63         LICENSES/stand-alone/GPL-3.0 \
64         tools/logger.pl \
65         tools/rlink_make_speed_table \
66         tools/st7_dtc_as \
67         contrib
68
69 libtool: $(LIBTOOL_DEPS)
70         $(SHELL) ./config.status --recheck
71
72 docs: pdf html doxygen
73
74 Doxyfile: $(srcdir)/Doxyfile.in
75         @echo "Creating $@ from $<..."
76         @( \
77           echo "### @@@ -= DO NOT EDIT THIS FILE =- @@@ ###" && \
78           echo "### @@@ Make changes to Doxyfile.in @@@ ###" && \
79           sed -e 's,@srcdir\@,$(srcdir),' \
80             -e 's,@builddir\@,$(builddir),' \
81             -e 's,@doxygen_as_html\@,$(doxygen_as_html),' \
82             -e 's,@doxygen_as_pdf\@,$(doxygen_as_pdf),' $< \
83         ) > $@
84
85 THE_MANUAL = doxygen/latex/refman.pdf
86
87 doxygen::
88         $(MAKE) Doxyfile
89         doxygen Doxyfile 2>&1 | perl $(srcdir)/tools/logger.pl > doxygen.log
90         @if [ -f doxygen/latex/refman.tex ]; then \
91                 echo "Creating $(THE_MANUAL)..."; \
92                 $(MAKE) $(THE_MANUAL); \
93         else \
94                 echo "Skipping Doxygen PDF..."; \
95         fi
96
97 $(THE_MANUAL): %.pdf: %.tex
98         -cd $$(dirname $*) && pdflatex $$(basename $*)
99         -cd $$(dirname $*) && pdflatex $$(basename $*)
100
101 TCL_PATH = tcl
102 # command to find paths of script files, relative to TCL_PATH
103 TCL_FILES = find $(srcdir)/$(TCL_PATH) -name '*.cfg' -o -name '*.tcl' -o -name '*.txt' | \
104                 sed -e 's,^$(srcdir)/$(TCL_PATH),,'
105
106 dist-hook:
107         if test -d $(srcdir)/.git -a \( ! -e $(distdir)/ChangeLog -o -w $(distdir)/ChangeLog \) ; then \
108                 git --git-dir $(srcdir)/.git log | $(srcdir)/tools/git2cl/git2cl > $(distdir)/ChangeLog ; \
109         fi
110         for i in $$($(TCL_FILES)); do \
111                 j="$(distdir)/$(TCL_PATH)/$$i" && \
112                 mkdir -p "$$(dirname $$j)" && \
113                 $(INSTALL_DATA) $(srcdir)/$(TCL_PATH)/$$i $$j; \
114         done
115
116 install-data-hook:
117         for i in $$($(TCL_FILES)); do \
118                 j="$(DESTDIR)$(pkgdatadir)/scripts/$$i" && \
119                 mkdir -p "$$(dirname $$j)" && \
120                 $(INSTALL_DATA) $(srcdir)/$(TCL_PATH)/$$i $$j; \
121         done
122
123 uninstall-hook:
124         rm -rf $(DESTDIR)$(pkgdatadir)/scripts
125
126 distclean-local:
127         rm -rf Doxyfile doxygen
128         rm -f $(srcdir)/jimtcl/configure.gnu
129 # FIXME: workaround for jimtcl 0.80 only. Remove from jimtcl 0.81
130         rm -f jimtcl/examples.api/Makefile
131
132 DISTCLEANFILES = doxygen.log
133
134 METASOURCES = AUTO
135
136 BUILT_SOURCES =
137 CLEANFILES =
138
139 MAINTAINERCLEANFILES = \
140         %D%/INSTALL \
141         %D%/configure \
142         %D%/Makefile.in \
143         %D%/depcomp \
144         %D%/config.guess \
145         %D%/config.sub \
146         %D%/config.h.in \
147         %D%/config.h.in~ \
148         %D%/compile \
149         %D%/ltmain.sh \
150         %D%/missing \
151         %D%/aclocal.m4 \
152         %D%/install-sh \
153         %D%/texinfo.tex
154
155 include src/Makefile.am
156 include doc/Makefile.am