$NetBSD: patch-Makefile,v 1.3 2020/06/19 21:17:46 scole Exp $ use options framework and libtool --- Makefile.orig 2019-08-29 01:58:04.000000000 +0000 +++ Makefile @@ -15,7 +15,7 @@ # Obviously, you must select at least one of the available gzip, lzma, lzo # compression types. # -GZIP_SUPPORT = 1 +#GZIP_SUPPORT = 1 ########### Building XZ support ############# # @@ -85,7 +85,7 @@ GZIP_SUPPORT = 1 # in Mksquashfs. Obviously the compression algorithm must have been # selected to be built # -COMP_DEFAULT = gzip +#COMP_DEFAULT = gzip ############################################### @@ -97,7 +97,7 @@ COMP_DEFAULT = gzip # If your C library or build/target environment doesn't support XATTRs then # comment out the next line to build Mksquashfs and Unsquashfs without XATTR # support -XATTR_SUPPORT = 1 +#XATTR_SUPPORT = 1 # Select whether you wish xattrs to be stored by Mksquashfs and extracted # by Unsquashfs by default. If selected users can disable xattr support by @@ -105,7 +105,7 @@ XATTR_SUPPORT = 1 # # If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by # default. Users can enable xattrs by using the -xattrs option. -XATTR_DEFAULT = 1 +#XATTR_DEFAULT = 1 ############################################### @@ -277,11 +277,15 @@ $(error "COMP_DEFAULT is set to ${COMP_D built!") endif +%.lo : %.c + $(LIBTOOL) --mode=compile --tag=CC $(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $< + .PHONY: all all: mksquashfs unsquashfs -mksquashfs: $(MKSQUASHFS_OBJS) - $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(MKSQUASHFS_OBJS) $(LIBS) -o $@ +mksquashfs: $(MKSQUASHFS_OBJS:.o=.lo) + $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(MKSQUASHFS_OBJS:.o=.lo) \ + $(LDFLAGS) $(EXTRA_LDFLAGS) $(LIBS) mksquashfs.o: Makefile mksquashfs.c squashfs_fs.h squashfs_swap.h mksquashfs.h \ sort.h pseudo.h compressor.h xattr.h action.h error.h progressbar.h \ @@ -331,8 +335,9 @@ lz4_wrapper.o: lz4_wrapper.c squashfs_fs xz_wrapper.o: xz_wrapper.c squashfs_fs.h xz_wrapper.h compressor.h -unsquashfs: $(UNSQUASHFS_OBJS) - $(CC) $(LDFLAGS) $(EXTRA_LDFLAGS) $(UNSQUASHFS_OBJS) $(LIBS) -o $@ +unsquashfs: $(UNSQUASHFS_OBJS:.o=.lo) + $(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(UNSQUASHFS_OBJS:.o=.lo) \ + $(LDFLAGS) $(EXTRA_LDFLAGS) $(LIBS) unsquashfs.o: unsquashfs.h unsquashfs.c squashfs_fs.h squashfs_swap.h \ squashfs_compat.h xattr.h read_fs.h compressor.h