$NetBSD: patch-Makefile,v 1.4 2023/10/03 19:26:20 scole Exp $ use options framework and libtool --- Makefile.orig 2023-03-25 20:53:37.000000000 +0000 +++ Makefile @@ -22,7 +22,7 @@ ifndef CONFIG # Obviously, you must select at least one of the available gzip, xz, lzo, # lz4, zstd or lzma (deprecated) compression types. # -GZIP_SUPPORT = 1 +#GZIP_SUPPORT = 1 ########### Building XZ support ############# # @@ -92,7 +92,7 @@ GZIP_SUPPORT = 1 # in Mksquashfs. Obviously the compression algorithm must have been # selected to be built # -COMP_DEFAULT = gzip +#COMP_DEFAULT = gzip ############################################### @@ -104,7 +104,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 @@ -112,7 +112,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 ############################################### @@ -364,12 +364,15 @@ YEAR := $(firstword $(subst /, , $(DATE) CFLAGS += -DVERSION=\"$(VERSION)\" -DDATE=\"$(DATE)\" -DYEAR=\"$(YEAR)\" +%.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 $@ - ln -sf mksquashfs sqfstar +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 mksquashfs_error.h progressbar.h \ @@ -428,9 +431,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 $@ - ln -sf unsquashfs sqfscat +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 unsquashfs_error.h