1# Copyright 1996-2004,2006-2010 Alain Knaff. 2# This file is part of mtools. 3# 4# Mtools is free software: you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation, either version 3 of the License, or 7# (at your option) any later version. 8# 9# Mtools is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with Mtools. If not, see <http://www.gnu.org/licenses/>. 16# 17# Makefile for Mtools 18# 19# check the Configure file for some examples of device-specific setups 20# Berkeley flavors of Unix should include -DBSD in the CFLAGS. Pick 21# a lock method... either -DLOCKF, -DFLOCK, or -DFCNTL and put that 22# string in the CFLAGS line below. 23 24# User specified flags 25USERCFLAGS = 26USERLDFLAGS = 27USERLDLIBS = 28 29MAKEINFO = makeinfo 30TEXI2DVI = texi2dvi 31TEXI2PDF = texi2pdf 32TEXI2HTML = texi2html 33 34 35# do not edit below this line 36# ============================================================================= 37 38SHELL = /bin/sh 39 40top_srcdir=@top_srcdir@ 41srcdir=@srcdir@ 42VPATH=@srcdir@ 43 44prefix = @prefix@ 45exec_prefix = @exec_prefix@ 46bindir = @bindir@ 47infodir = @infodir@ 48mandir = @mandir@ 49sysconfdir = @sysconfdir@ 50datarootdir = @datarootdir@ 51 52CC = @CC@ 53CXX = @CXX@ 54MYCFLAGS = @CFLAGS@ 55MYCXXFLAGS = @CXXFLAGS@ 56CPPFLAGS = @CPPFLAGS@ 57HOST_ID = @HOST_ID@ 58DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)\" $(HOST_ID) 59 60LDFLAGS = @LDFLAGS@ 61LIBS = @LIBS@ 62SHLIB = @SHLIB@ 63MACHDEPLIBS = @MACHDEPLIBS@ 64LN_S = @LN_S@ 65 66INSTALL = @INSTALL@ 67INSTALL_PROGRAM = @INSTALL_PROGRAM@ 68INSTALL_DATA = @INSTALL_DATA@ 69INSTALL_INFO = @INSTALL_INFO@ 70 71.SUFFIXES: 72.SUFFIXES: .o .c 73.SUFFIXES: .o .c 74 75MAN1 = floppyd.1 floppyd_installtest.1 mattrib.1 mbadblocks.1 mcat.1 \ 76mcd.1 mcopy.1 mdel.1 mdeltree.1 mdir.1 mdu.1 mformat.1 \ 77minfo.1 mkmanifest.1 mlabel.1 mmd.1 mmount.1 mmove.1 mpartition.1 \ 78mrd.1 mren.1 mshortname.1 mshowfat.1 mtoolstest.1 mtools.1 mtype.1 \ 79mzip.1 80 81MAN1EXT = 1 82MAN1DIR = $(DESTDIR)$(mandir)/man${MAN1EXT} 83MAN5 = mtools.5 84MAN5EXT = 5 85MAN5DIR = $(DESTDIR)$(mandir)/man${MAN5EXT} 86 87# objects for building mtools 88OBJS_MTOOLS = buffer.o charsetConv.o codepages.o config.o copyfile.o \ 89device.o devices.o dirCache.o directory.o direntry.o dos2unix.o \ 90expand.o fat.o fat_free.o file.o file_name.o force_io.o hash.o init.o \ 91lba.o llong.o lockdev.o match.o mainloop.o mattrib.o mbadblocks.o \ 92mcat.o mcd.o mcopy.o mdel.o mdir.o mdoctorfat.o mdu.o \ 93mformat.o minfo.o misc.o missFuncs.o mk_direntry.o mlabel.o mmd.o \ 94mmount.o mmove.o mpartition.o mshortname.o mshowfat.o mzip.o mtools.o \ 95offset.o old_dos.o open_image.o patchlevel.o partition.o plain_io.o \ 96precmd.o privileges.o remap.o scsi_io.o scsi.o signal.o stream.o \ 97streamcache.o swap.o unix2dos.o unixdir.o tty.o vfat.o \ 98strtonum.o @FLOPPYD_IO_OBJ@ @XDF_IO_OBJ@ 99 100# objects for building mkmanifest 101OBJS_MKMANIFEST = missFuncs.o mkmanifest.o misc.o patchlevel.o 102 103# objects for building floppyd 104OBJS_FLOPPYD = floppyd.o llong.o lockdev.o 105 106# objects for building floppyd_installtest 107OBJS_FLOPPYD_INSTALLTEST = floppyd_installtest.o misc.o expand.o \ 108privileges.o strtonum.o 109 110SRCS = buffer.c codepages.c config.c copyfile.c device.c devices.c \ 111dirCache.c directory.c direntry.c dos2unix.c expand.c fat.c \ 112fat_free.c file.c file_name.c file_read.c force_io.c hash.c init.c \ 113lba.c lockdev.c match.c mainloop.c mattrib.c mbadblocks.c mcat.c \ 114mcd.c mcopy.c mdel.c mdir.c mdu.c mdoctorfat.c \ 115mformat.c minfo.c misc.c missFuncs.c mk_direntry.c mlabel.c mmd.c \ 116mmount.c mmove.c mpartition.c mshortname.c mshowfat.c mzip.c mtools.c \ 117offset.c old_dos.c open_image.c partition.c plain_io.c precmd.c \ 118privileges.c remap.c scsi_io.c scsi.c signal.c stream.c streamcache.c \ 119swap.c unix2dos.s unixdir.c tty.c vfat.c mkmanifest.c \ 120@FLOPPYD_IO_SRC@ @XDF_IO_SRC@ 121 122SRCS-@USE_FLOPPYD@ += floppyd_io.c 123SRCS-@USE_XDF@ += xdf_io.c 124 125SCRIPTS = mcheck mxtar uz tgz mcomp amuFormat.sh 126 127LINKS=mattrib mcat mcd mcopy mdel mdeltree mdir mdu \ 128mformat minfo mlabel mmd mmount mmove mpartition mrd mren mtype \ 129mtoolstest mshortname mshowfat mbadblocks mzip 130 131X_CFLAGS = @X_CFLAGS@ 132X_LIBS = @X_LIBS@ 133X_EXTRA_LIBS = @X_EXTRA_LIBS@ 134X_PRE_LIBS = @X_PRE_LIBS@ 135CFLAGS = $(CPPFLAGS) $(DEFS) $(MYCFLAGS) -fno-strict-aliasing -I. @extraincludedir@ -I@srcdir@ $(USERCFLAGS) 136CXXFLAGS = $(CPPFLAGS) $(DEFS) $(MYCXXFLAGS) -I. @extraincludedir@ -I@srcdir@ $(USERCFLAGS) 137LINK = $(CC) $(LDFLAGS) $(USERLDFLAGS) @extralibdir@ 138ALLLIBS = $(USERLDLIBS) $(MACHDEPLIBS) $(SHLIB) $(LIBS) 139X_LDFLAGS = $(X_EXTRA_LIBS) $(X_LIBS) @FLOPPYD_LIBS@ $(LIBS) 140X_CCFLAGS = $(X_CFLAGS) $(CFLAGS) 141 142all: mtools $(LINKS) mkmanifest @FLOPPYD@ mtools.1 mtools.5 143 144%.o: %.c 145 $(CC) $(CFLAGS) -c $< 146 147#%.o: %.cpp 148# $(CXX) $(CXXFLAGS) -c $< 149 150mtools: $(OBJS_MTOOLS) 151 $(LINK) $(OBJS_MTOOLS) -o $@ $(ALLLIBS) 152 153mkmanifest: $(OBJS_MKMANIFEST) 154 $(LINK) $(OBJS_MKMANIFEST) -o $@ $(ALLLIBS) 155 156floppyd.o: floppyd.c 157 $(CC) $(X_CCFLAGS) -c $? 158 159floppyd: $(OBJS_FLOPPYD) 160 $(LINK) $(OBJS_FLOPPYD) -o $@ $(X_LDFLAGS) 161floppyd_installtest: $(OBJS_FLOPPYD_INSTALLTEST) 162 $(LINK) $(OBJS_FLOPPYD_INSTALLTEST) -o $@ $(ALLLIBS) 163 164 165$(LINKS): mtools 166 rm -f $@ && $(LN_S) mtools $@ 167 168mostlyclean: 169 -rm -f *~ *.orig *.o a.out core 2>/dev/null 170 171clean: mostlyclean 172 -rm -f mtools $(LINKS) floppyd floppyd_installtest mkmanifest *.info* *.dvi *.html 2>/dev/null 173 174 175texclean: 176 -rm -f mtools.aux mtools.toc mtools.log 177 -rm -f mtools.cps mtools.pgs mtools.vrs 178 -rm -f mtools.cp mtools.fn mtools.ky 179 -rm -f mtools.pg mtools.tp mtools.vr 180 181info: mtools.info 182%.info: %.texi sysconfdir.texi 183 $(MAKEINFO) -I$(srcdir) $< --no-split --output=$@ 184 185dvi: mtools.dvi 186%.dvi: %.texi sysconfdir.texi 187 $(TEXI2DVI) $< 188 189ps: mtools.ps 190%.ps: %.dvi 191 dvips -f < $< > $@ 192 193pdf: mtools.pdf 194%.pdf: %.texi sysconfdir.texi 195 $(TEXI2PDF) $< 196 197mtools.1: mtools.tmpl.1 Makefile 198 sed "s%SYSCONFDIR%$(sysconfdir)/%g" $(srcdir)/mtools.tmpl.1 >mtools.1 199 200mtools.5: mtools.tmpl.5 Makefile 201 sed "s%SYSCONFDIR%$(sysconfdir)/%g" $(srcdir)/mtools.tmpl.5 >mtools.5 202 203sysconfdir.texi: 204 echo "@set SYSCONFDIR $(sysconfdir)/" >sysconfdir.texi 205 206html: mtools.html mtools_toc.html 207%.html %_toc.html: %.texi sysconfdir.texi 208 $(TEXI2HTML) $< 209 210# Don't cd, to avoid breaking install-sh references. 211install-info: info 212 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(infodir) 213 if test -f mtools.info; then \ 214 for i in mtools.info*; do \ 215 $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i; \ 216 done; \ 217 else \ 218 for i in $(srcdir)/mtools.info*; do \ 219 $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/`echo $$i | sed 's|^$(srcdir)/||'`; \ 220 done; \ 221 fi; \ 222 if [ -n "$(INSTALL_INFO)" ] ; then \ 223 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/mtools.info; \ 224 fi 225 226uninstall-info: 227 cd $(DESTDIR)$(infodir) && rm -f mtools.info* 228 229install: $(DESTDIR)$(bindir)/mtools @BINFLOPPYD@ install-man install-links \ 230 $(DESTDIR)$(bindir)/mkmanifest install-scripts install-info 231 232uninstall: uninstall-bin uninstall-man uninstall-links \ 233 uninstall-scripts 234 235distclean: clean texclean 236 rm -f config.cache config.h config.status config.log Makefile 237maintainer-clean: distclean 238 239 240$(DESTDIR)$(bindir)/floppyd: floppyd 241 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) 242 $(INSTALL_PROGRAM) floppyd $(DESTDIR)$(bindir)/floppyd 243 244$(DESTDIR)$(bindir)/floppyd_installtest: floppyd_installtest 245 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) 246 $(INSTALL_PROGRAM) floppyd_installtest $(DESTDIR)$(bindir)/floppyd_installtest 247 248$(DESTDIR)$(bindir)/mtools: mtools 249 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) 250 $(INSTALL_PROGRAM) mtools $(DESTDIR)$(bindir)/mtools 251 252$(DESTDIR)$(bindir)/mkmanifest: mkmanifest 253 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) 254 $(INSTALL_PROGRAM) mkmanifest $(DESTDIR)$(bindir)/mkmanifest 255 256#$(ETCDIR)/mtools: mtools.etc 257# cp mtools.etc $(ETCDIR)/mtools 258 259install-links: $(DESTDIR)$(bindir)/mtools 260 @for j in $(LINKS); do \ 261 rm -f $(DESTDIR)$(bindir)/$$j ; \ 262 $(LN_S) mtools $(DESTDIR)$(bindir)/$$j ; \ 263 echo $(DESTDIR)$(bindir)/$$j ; \ 264 done 265 266## "z" is the older version of "gz"; the name is just *too* short 267install-scripts: $(DESTDIR)$(bindir)/mtools 268 @$(top_srcdir)/mkinstalldirs $(DESTDIR)$(bindir) 269 @for j in $(SCRIPTS) ; do \ 270 $(INSTALL_PROGRAM) $(srcdir)/scripts/$$j $(DESTDIR)$(bindir)/$$j ; \ 271 echo $(DESTDIR)$(bindir)/$$j ; \ 272 done 273 rm -f $(DESTDIR)$(bindir)/lz 274 cd $(DESTDIR)$(bindir) && $(LN_S) uz lz 275 276install-man: 277 @$(top_srcdir)/mkinstalldirs $(MAN1DIR) 278 @for j in $(MAN1); do \ 279 $(INSTALL_DATA) $(srcdir)/$$j $(MAN1DIR)/$$j ; \ 280 echo $(MAN1DIR)/$$j ; \ 281 done 282 @$(top_srcdir)/mkinstalldirs $(MAN5DIR) 283 @for j in $(MAN5); do \ 284 $(INSTALL_DATA) $(srcdir)/$$j $(MAN5DIR)/$$j ; \ 285 echo $(MAN5DIR)/$$j ; \ 286 done 287 288uninstall-bin: 289 @for j in mtools mkmanifest; do \ 290 rm -f $(DESTDIR)$(bindir)/$$j ; \ 291 echo $(DESTDIR)$(bindir)/$$j ; \ 292 done 293 294uninstall-scripts: 295 @for j in $(SCRIPTS); do \ 296 rm -f $(DESTDIR)$(bindir)/$$j ; \ 297 echo $(DESTDIR)$(bindir)/$$j ; \ 298 done 299 300uninstall-man: 301 @for j in $(MAN1); do \ 302 rm -f $(MAN1DIR)/$$j ; \ 303 echo $(MAN1DIR)/$$j ; \ 304 done 305 @for j in $(MAN5); do \ 306 rm -f $(MAN5DIR)/$$j ; \ 307 echo $(MAN5DIR)/$$j ; \ 308 done 309 310uninstall-links: 311 @for j in $(LINKS); \ 312 do rm -f $(DESTDIR)$(bindir)/$$j ; \ 313 echo $(DESTDIR)$(bindir)/$$j ; \ 314 done 315 316depend: $(SRCS) 317 makedepend -- $(CFLAGS) -- $^ 318 319check: 320 echo No self tests included 321# check target needed even if empty, in order to make life easier for 322# automatic tools to install GNU soft 323 324 325# DO NOT DELETE THIS LINE -- make depend depends on it. 326