Coverity fixes, etc from Nelson
[sxemacs] / lib-src / Makefile.am
1 ## SXEmacs Makefile.am
2
3 ## Copyright (C) 2007 Steve Youngs
4
5 ## This file is part of SXEmacs.
6
7 ## SXEmacs 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 3 of the License, or
10 ## (at your option) any later version.
11
12 ## SXEmacs is distributed in the hope that it will be useful,
13 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 ## GNU General Public License for more details.
16
17 ## You should have received a copy of the GNU General Public License
18 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20 ## Process this file with automake to produce Makefile.in
21
22 # Help the Developers and yourself. Just use the C locale and settings
23 # for the compilation. They can still be overriden by make LANG=<whatever>
24 # but that is general a not very good idea
25 LANG=C
26 LC_ALL=C
27
28 builddir = @builddir@
29 srcdir = @srcdir@
30 top_builddir = @top_builddir@
31 top_build_prefix = $(top_builddir)/
32 top_srcdir = @top_srcdir@
33 abs_top_builddir = @abs_top_builddir@
34 abs_top_srcdir = @abs_top_srcdir@
35
36 ETAGS = $(builddir)/etags
37 TAGS_DEPENDENCIES = $(ETAGS)
38
39 headerdir = $(includedir)/$(instvarsepdir)
40 archlibdir = ${libdir}/${instvardir}/${configuration}
41
42 sxesrcdir = $(top_srcdir)/src
43 bldsrcdir = $(top_builddir)/src
44 sxelispdir = $(abs_top_srcdir)/lisp
45 bldlispdir = $(abs_top_builddir)/lisp
46 sxelibsrcdir = $(top_srcdir)/lib-src
47 bldlibsrcdir = $(top_builddir)/lib-src
48
49 AM_CFLAGS =
50 AM_CPPFLAGS = -I$(sxesrcdir) $(c_switch_all)
51 AM_LDFLAGS = $(ld_switch_general) $(ld_libs_general)
52
53 REGEX_C = $(sxesrcdir)/regex.c $(sxesrcdir)/regex.h
54 REGEX_CF = -DINHIBIT_STRING_HEADER
55 ALLOCA_C = $(sxesrcdir)/alloca.c
56
57 ## stuff we create here
58 bin_PROGRAMS = gnuclient etags ctags2 ootags
59 archlib_PROGRAMS = gnuserv fakemail wakeup profile make-docfile \
60         sorted-doc movemail yow hexl mmencode
61 noinst_PROGRAMS = make-path make-dump-id
62 dist_noinst_SCRIPTS = ad2c
63
64 ## how do we create
65 gnuclient_SOURCES = gnuserv.h gnuslib.c gnuclient.c
66 gnuserv_SOURCES = gnuserv.h gnuslib.c gnuserv.c
67 fakemail_SOURCES = fakemail.c
68 wakeup_SOURCES = wakeup.c
69 profile_SOURCES = profile.c
70 make_docfile_SOURCES = make-docfile.c
71 sorted_doc_SOURCES = sorted-doc.c
72 yow_SOURCES = yow.c
73 hexl_SOURCES = hexl.c
74 mmencode_SOURCES = mmencode.c
75 make_dump_id_SOURCES = make-dump-id.c
76
77 make_path_SOURCES = make-path.c
78 make_path_CFLAGS = -Demacs
79
80 movemail_SOURCES = movemail.c pop.c pop.h $(REGEX_C)
81 movemail_CFLAGS = $(AM_CFLAGS) $(REGEX_CF)
82 movemail_CPPFLAGS = $(AM_CPPFLAGS)
83 if WITH_BDWGC
84 movemail_CPPFLAGS += $(BDWGC_CPPFLAGS)
85 movemail_LDADD = $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
86 endif
87
88 ctags2_SOURCES = $(REGEX_C) etags.c
89 EXTRA_ctags2_SOURCES = $(ALLOCA_C)
90 ctags2_CFLAGS = $(REGEX_CF) -DCTAGS
91 ctags2_LDADD =
92 if NEED_ALLOCA_C
93 ctags2_LDADD += $(ALLOCA_C)
94 endif
95 ctags2_CPPFLAGS = $(AM_CPPFLAGS)
96 if WITH_BDWGC
97 ctags2_CPPFLAGS += $(BDWGC_CPPFLAGS)
98 ctags2_LDADD += $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
99 endif
100 ctags2_DEPENDENCIES = $(ALLOCA)
101
102 etags_SOURCES = $(REGEX_C) etags.c
103 EXTRA_etags_SOURCES = $(ALLOCA_C)
104 etags_CFLAGS = $(REGEX_CF) -DETAGS -DEMACS_NAME="\"SXEmacs\""
105 etags_LDADD =
106 if NEED_ALLOCA_C
107 etags_LDADD += $(ALLOCA_C)
108 endif
109 etags_CPPFLAGS = $(AM_CPPFLAGS)
110 if WITH_BDWGC
111 etags_CPPFLAGS += $(BDWGC_CPPFLAGS)
112 etags_LDADD += $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
113 endif
114 etags_DEPENDENCIES = $(ALLOCA)
115
116 ootags_SOURCES = $(REGEX_C) ootags.c
117 ootags_CFLAGS = $(REGEX_CF) -DOOTAGS
118 ootags_CPPFLAGS = $(AM_CPPFLAGS)
119 if WITH_BDWGC
120 ootags_CPPFLAGS += $(BDWGC_CPPFLAGS)
121 ootags_LDADD = $(BDWGC_LDFLAGS) $(BDWGC_LIBS)
122 endif
123
124 ## custom rules
125 RM = rm -f
126
127 stage1: $(bin_PROGRAMS) $(archlib_PROGRAMS)  \
128         $(archlib_SCRIPTS) $(noinst_PROGRAMS) $(dist_archlib_DATA)
129         @touch $@
130
131 stage2: stage1 ##DOC
132         @touch $@
133
134 ### dont use staged build
135 ##all: stage1 stage2
136
137 CLEANFILES = core* stage1 stage2
138
139 install-exec-hook:
140         cd $(DESTDIR)$(bindir) && \
141         mv -f ctags2 ctags
142
143 uninstall-hook:
144         cd $(DESTDIR)$(bindir) && \
145         $(RM) ctags
146
147 #
148 # Help the SXEmacs developers get nice post-processed source files
149
150 ## Create preprocessor output (debugging purposes only)
151 .c.i:
152         $(COMPILE) -E -o $@ $<
153
154 ## Create assembler output (debugging purposes only)
155 .c.s:
156         $(COMPILE) -S -c $(cflags) $<