From: =?UTF-8?q?Rog=C3=A9rio=20Brito?= <rbrito@ime.usp.br>
Date: Thu, 24 Oct 2013 01:11:21 -0200
Subject: Create short Makefiles for Debian

Create short Makefiles for compiling just the necessary parts for a
Debian-based (and possibly other distributions) HFS+ filesystem
utilities.
---
 Makefile.lnx                       |  8 ++++++++
 fsck_hfs.tproj/Makefile.lnx        | 16 ++++++++++++++++
 fsck_hfs.tproj/dfalib/Makefile.lnx | 15 +++++++++++++++
 newfs_hfs.tproj/Makefile.lnx       | 12 ++++++++++++
 4 files changed, 51 insertions(+)
 create mode 100644 Makefile.lnx
 create mode 100644 fsck_hfs.tproj/Makefile.lnx
 create mode 100644 fsck_hfs.tproj/dfalib/Makefile.lnx
 create mode 100644 newfs_hfs.tproj/Makefile.lnx

diff --git a/Makefile.lnx b/Makefile.lnx
new file mode 100644
index 0000000..687d1e7
--- /dev/null
+++ b/Makefile.lnx
@@ -0,0 +1,8 @@
+CC := gcc
+CFLAGS += -I$(PWD)/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1
+SUBDIRS := newfs_hfs.tproj fsck_hfs.tproj
+
+all clean:
+	for d in $(SUBDIRS); do $(MAKE) -C $$d -f Makefile.lnx $@; done
+
+export CC CFLAGS
diff --git a/fsck_hfs.tproj/Makefile.lnx b/fsck_hfs.tproj/Makefile.lnx
new file mode 100644
index 0000000..977d7e8
--- /dev/null
+++ b/fsck_hfs.tproj/Makefile.lnx
@@ -0,0 +1,16 @@
+CFILES = fsck_hfs.c strings.c utilities.c cache.c fsck_debug.c
+OFILES = $(CFILES:.c=.o)
+
+all: fsck_hfs
+
+fsck_hfs: $(OFILES) dfalib/libdfa.a
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) dfalib/libdfa.a
+
+dfalib/libdfa.a: FORCE
+	$(MAKE) -C dfalib -f Makefile.lnx CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" libdfa.a
+
+clean:
+	$(RM) fsck_hfs $(OFILES)
+	$(MAKE) -C dfalib -f Makefile.lnx clean
+
+.PHONY : FORCE clean
diff --git a/fsck_hfs.tproj/dfalib/Makefile.lnx b/fsck_hfs.tproj/dfalib/Makefile.lnx
new file mode 100644
index 0000000..8c07196
--- /dev/null
+++ b/fsck_hfs.tproj/dfalib/Makefile.lnx
@@ -0,0 +1,15 @@
+CFILES = hfs_endian.c BlockCache.c\
+         BTree.c BTreeAllocate.c BTreeMiscOps.c \
+         BTreeNodeOps.c BTreeScanner.c BTreeTreeOps.c\
+         CatalogCheck.c HardLinkCheck.c\
+         SBTree.c SControl.c SVerify1.c SVerify2.c\
+         SRepair.c SRebuildCatalogBTree.c\
+         SUtils.c SKeyCompare.c SDevice.c SExtents.c SAllocate.c\
+         SCatalog.c SStubs.c VolumeBitmapCheck.c
+OFILES = $(CFILES:.c=.o)
+
+libdfa.a: $(OFILES)
+	$(AR) rc $@ $?
+
+clean:
+	$(RM) $(OFILES) libdfa.a
diff --git a/newfs_hfs.tproj/Makefile.lnx b/newfs_hfs.tproj/Makefile.lnx
new file mode 100644
index 0000000..58e6700
--- /dev/null
+++ b/newfs_hfs.tproj/Makefile.lnx
@@ -0,0 +1,12 @@
+CFILES = hfs_endian.c makehfs.c newfs_hfs.c
+OFILES = $(CFILES:.c=.o)
+
+all: newfs_hfs
+
+newfs_hfs: $(OFILES)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OFILES) -lcrypto
+
+clean:
+	$(RM) newfs_hfs $(OFILES)
+
+.PHONY : FORCE clean
