From f70b5897de5992487b27dd644bacb77cc34839fd Mon Sep 17 00:00:00 2001 From: ksherlock Date: Wed, 9 Mar 2011 05:58:10 +0000 Subject: [PATCH] conditional NUFX Support git-svn-id: https://profuse.googlecode.com/svn/branches/v2@382 aa027e90-d47c-11dd-86d7-074df07e0730 --- Device/BlockDevice.cpp | 18 +++++++++++++----- Device/SDKImage.cpp | 1 + Makefile | 25 +++++++++++++++---------- bin/fuse_pascal.cpp | 3 +++ 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/Device/BlockDevice.cpp b/Device/BlockDevice.cpp index 9418d89..6ac1d9e 100644 --- a/Device/BlockDevice.cpp +++ b/Device/BlockDevice.cpp @@ -19,7 +19,10 @@ #include #include #include + +#ifdef HAVE_NUFX #include +#endif using namespace Device; @@ -38,9 +41,11 @@ unsigned BlockDevice::ImageType(MappedFile *f, unsigned defv) if (DiskCopy42Image::Validate(f, std::nothrow)) return 'DC42'; - + +#ifdef HAVE_NUFX if (SDKImage::Validate(f, std::nothrow)) return 'SDK_'; +#endif if (ProDOSOrderDiskImage::Validate(f, std::nothrow)) return 'PO__'; @@ -97,13 +102,14 @@ unsigned BlockDevice::ImageType(const char *type, unsigned defv) if (::strcasecmp(type, "davex") == 0) return 'DVX_'; - - // not supported yet. + +#ifdef HAVE_NUFX if (::strcasecmp(type, "sdk") == 0) return 'SDK_'; if (::strcasecmp(type, "shk") == 0) return 'SDK_'; - +#endif + return defv; } @@ -150,9 +156,11 @@ BlockDevicePointer BlockDevice::Open(const char *name, File::FileFlags flags, un case 'DVX_': return DavexDiskImage::Open(&file); - + +#if HAVE_NUFX case 'SDK_': return SDKImage::Open(name); +#endif } diff --git a/Device/SDKImage.cpp b/Device/SDKImage.cpp index 4667589..3c27530 100644 --- a/Device/SDKImage.cpp +++ b/Device/SDKImage.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include diff --git a/Makefile b/Makefile index d9e0f16..45cf1cf 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,20 @@ CC = g++ CPPFLAGS += -Wall -W -Wno-multichar -I. -O2 -g -LDFLAGS += -lpthread +LIBS += -lpthread UNAME = $(shell uname -s) ifeq ($(UNAME),Darwin) - fuse_pascal_LDFLAGS += -lfuse_ino64 + fuse_pascal_LIBS += -lfuse_ino64 else - fuse_pascal_LDFLAGS += -lfuse + fuse_pascal_LIBS += -lfuse endif - - +ifdef HAVE_NUFX + DEVICE_OBJECTS += Device/SDKImage.o + LDFLAGS += -L/usr/local/lib/ + LIBS += -lnufx -lz + CPPFLAGS += -DHAVE_NUFX=1 +endif OBJECTS += ${wildcard *.o} @@ -43,6 +47,7 @@ DEVICE_OBJECTS += Device/DiskImage.o DEVICE_OBJECTS += Device/RawDevice.o DEVICE_OBJECTS += Device/UniversalDiskImage.o + ENDIAN_OBJECTS += Endian/Endian.o FILE_OBJECTS += File/File.o @@ -60,7 +65,7 @@ PROFUSE_OBJECTS += ProFUSE/Lock.o xattr: bin/xattr.o - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ newfs_pascal: bin/newfs_pascal.o \ ${CACHE_OBJECTS} \ @@ -69,7 +74,7 @@ newfs_pascal: bin/newfs_pascal.o \ ${FILE_OBJECTS} \ ${PROFUSE_OBJECTS} \ ${PASCAL_OBJECTS} - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ apfm: bin/apfm.o \ ${CACHE_OBJECTS} \ @@ -78,7 +83,7 @@ apfm: bin/apfm.o \ ${FILE_OBJECTS} \ ${PROFUSE_OBJECTS} \ ${PASCAL_OBJECTS} - $(CC) $(LDFLAGS) $^ -o $@ + $(CC) $(LDFLAGS) $^ $(LIBS) -o $@ fuse_pascal: bin/fuse_pascal.o bin/fuse_pascal_ops.o \ @@ -87,8 +92,8 @@ fuse_pascal: bin/fuse_pascal.o bin/fuse_pascal_ops.o \ ${ENDIAN_OBJECTS} \ ${FILE_OBJECTS} \ ${PROFUSE_OBJECTS} \ - ${PASCAL_OBJECTS} - $(CC) $(fuse_pascal_LDFLAGS) $(LDFLAGS) $^ -o $@ + ${PASCAL_OBJECTS} + $(CC) $(LDFLAGS) $^ $(LIBS) $(fuse_pascal_LIBS) -o $@ clean: diff --git a/bin/fuse_pascal.cpp b/bin/fuse_pascal.cpp index e207ec6..ccfa4c4 100644 --- a/bin/fuse_pascal.cpp +++ b/bin/fuse_pascal.cpp @@ -44,6 +44,9 @@ void usage() " dc42 DiskCopy 4.2 Image\n" " davex Davex Disk Image\n" " 2img Universal Disk Image\n" +#ifdef HAVE_NUFX + " sdk ShrinkIt Disk Image\n" +#endif " do DOS Order Disk Image\n" " po ProDOS Order Disk Image (default)\n" " -o opt1,opt2... other mount parameters.\n"