#--------------------------------------------------------------- # Makefile for batch processing of frame format files # (requires GNU make utility version 3.78 at least) # # Last update: March 8, 2001 # Author: A.Sazonov (sazonov@phys.ufl.edu) # # For instructions, examples and newer versions see Web page # http://http://www.phys.ufl.edu/ligo/wavelet/compress.html #--------------------------------------------------------------- # selecting channels for FrCopy #CHANNELS = H2:LSC-AS_Q TAG = H2:LSC-AS_Q #TAG = H2:LSC* #TAG = -*Q # start and stop numbers of files in sorted input list # if BUNCH=10 or 100 then N1 and N2 count tens or hundreds N1 = 1 N2 = 10 #WITH_GZIP=yes # BUNCH is 'all', '10', or '100' #BUNCH = all # Set directory names where original files are located (INDIR) # where to place intermediate copies (COPYDIR) where to # place compressed (COMPDIR) and uncompressed ones (OUTDIR) # # Caution: make confuses if directory name contains ":" symbol # to access such directories create and use soft links to them. INDIR = ./frame COPYDIR = ./copy # if COPYDIR equal to INDIR then FrCopy stage is skipped #COPYDIR = $(INDIR) COMPDIR = ./wz OUTDIR = ./out # suffixes for input, compressed and uncompressed frame files ISFX = F CSFX = WZ OSFX = F # program names FRCOPY = FrCopy COMPRESS = WatFrComp UNCOMPRESS = WatFrUnComp # FrCopy options: '-c -1' means use for output the same # compression as input has COPY_OPT = -c -1 -d 0 # compression options # options: Lwt Lbt loss1 loss2 order1 order2 COMP_OPT = # option means applying of standard compress method 0,1,2,3 ... # after WAT uncompressing UNCOMP_OPT = 0 # ======= There are no user-definable options below this line ========= ifneq ($(CHANNELS),) override COPY_OPT += -a $(CHANNELS) endif ifneq ($(TAG),) override COPY_OPT += -t $(TAG) endif ifeq ($(BUNCH),10) override TAIL=0 else ifeq ($(BUNCH),100) override TAIL=00 else override TAIL= endif endif ifeq ($(MAKECMDGOALS),uncompress) override IN1 := $(notdir $(wildcard $(COMPDIR)/*.$(CSFX))) override IN2 := $(basename $(notdir $(wildcard $(COMPDIR)/*.$(CSFX).gz))) override IN := $(sort $(basename $(IN1) $(IN2))) else override IN := $(notdir $(wildcard $(INDIR)/*$(TAIL).$(ISFX))) override IN := $(sort $(basename $(IN))) endif # limit processing to files numbered from N1 to N2 ifdef N1 ifdef N2 override IN := $(wordlist $(N1),$(N2),$(IN)) ifeq ($(IN),) $(error N1 and N2 are out of range or input list empty) endif endif endif ifneq ($(COPYDIR),$(INDIR)) override COPYTARGET := $(COPYDIR)/%.$(ISFX) override CLEAN_COPY := \rm -rf $(COPYDIR)/*.$(ISFX) override COPYSOURCE := $(INDIR)/%.$(ISFX) endif ifeq ($(BUNCH),all) override COPYSOURCE := $(addprefix $(INDIR)/,$(addsuffix .$(ISFX),$(IN))) override IN := $(firstword $(IN)) override COPYTARGET := $(COPYDIR)/$(IN).$(ISFX) endif ifdef TAIL override COPYSOURCE = override COPYTARGET := $(COPYDIR)/%$(TAIL).$(ISFX) endif override FCP := $(addprefix $(COPYDIR)/,$(addsuffix .$(ISFX),$(IN))) override WZ := $(addprefix $(COMPDIR)/,$(addsuffix .$(CSFX),$(IN))) override OUT := $(addprefix $(OUTDIR)/, $(addsuffix .$(OSFX),$(IN))) ifeq ($(WITH_GZIP),yes) override WZ := $(addsuffix .gz,$(WZ)) override GZ_SFX = .gz endif info: @echo \ Syntax: make target options @echo \ targets are: frcopy, compress, uncompress, cleanout, cleancomp, cleanall, all dir: if [ ! -d $(COPYDIR) ]; then mkdir $(COPYDIR) ; fi; if [ ! -d $(COMPDIR) ]; then mkdir $(COMPDIR) ; fi; if [ ! -d $(OUTDIR) ]; then mkdir $(OUTDIR) ; fi; cleanall: cleanout cleancomp cleancp cleancp: $(CLEAN_COPY) cleanout: \rm -rf $(OUTDIR)/*.$(OSFX) cleancomp: \rm -rf $(COMPDIR)/*.$(CSFX) $(COMPDIR)/*.$(CSFX).gz all: compress uncompress frcopy: $(FCP) compress: $(WZ) uncompress: $(OUT) $(COPYTARGET) : $(COPYSOURCE) ifndef TAIL $(FRCOPY) -o $@ -i $+ $(COPY_OPT) else $(FRCOPY) -o $@ -i $(sort $(wildcard $(INDIR)/$(*F)*.$(ISFX))) $(COPY_OPT) endif $(OUTDIR)/%.$(OSFX) : $(COMPDIR)/%.$(CSFX) $(UNCOMPRESS) $< $@ $(UNCOMP_OPT) $(COMPDIR)/%.$(CSFX) : $(COMPDIR)/%.$(CSFX).gz gunzip -c $< > $@ $(COMPDIR)/%.$(CSFX)$(GZ_SFX) : $(COPYDIR)/%.$(ISFX) $(COMPRESS) $< $(COMPDIR)/$(*F).$(CSFX) $(COMP_OPT) ifeq ($(WITH_GZIP),yes) gzip $(COMPDIR)/$(*F).$(CSFX) endif