0

I am trying to write a makefile which will compress (zip) all the folders in my current working directory. What I got so far is:

SUBDIRS := $(wildcard */)
ZIPS := $(addsuffix .zip,$(subst /,,$(SUBDIRS)))
$(ZIPS) : %.zip : | %
    zip $@ $*/*
dist: $(ZIPS)

(from Makefile: Generating zip files of all sub folders)

this does however only generate a zip file of the first folder in my current working directory (I would like to generate zips of all).

Joar
  • 1
  • 1
  • Possible duplicate of [Makefile compile only the first file one makefile instructions](https://stackoverflow.com/questions/24909730/makefile-compile-only-the-first-file-one-makefile-instructions) – user657267 Apr 13 '18 at 04:35
  • I tried adding all: but now i get *** multiple target patterns. Stop. – Joar Apr 13 '18 at 06:51

1 Answers1

0

Just had to add all: $(ZIPS) as follows:

print-%  : ; @echo $* = $($*)
SUBDIRS := $(wildcard */)
ZIPS := $(addsuffix .zip,$(subst /,,$(SUBDIRS)))
all: $(ZIPS)
$(ZIPS) : %.zip : | %
    zip $@ $*/*
dist: $(ZIPS)
Joar
  • 1
  • 1