Building an Archive (.lha)

3 posts / 0 new
Last post
OldFart
OldFart's picture
Offline
Last seen: 15 hours 40 min ago
Joined: 2010-11-30 14:09
Building an Archive (.lha)

Hi,

I'm trying to build an archive, but encounter some issues that i would like to see solved.
For the record: the archive IS being built and CAN be released! So that's not the problem.

The problem is, that I get a level too much archived, an issue which I tried to solve with a 'CD'-command.

When building an archive, this sequence is performed (to a large extent):

  1. ARCHDIR = $(PROGNAME)_V$(PROGVERS).$(PROGREVN)
  2. ARCHNAME = $(ARCHDIR).lha
  3. #ARCHNAME = $(PROGNAME).lha
  4. #ARCHNAME = $(PROGNAME)_V$(PROGVERS).$(PROGREVN).lha
  5. DESTIN = "Releases/$(ARCHDIR)/$(PROGNAME)"
  6.  
  7.  
  8. .PHONY: create_archive
  9. create_archive:
  10. gcc $(DEFINES) $(INCLUDES) -N main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE)
  11. # gcc $(DEFINES) $(INCLUDES) -N ../../../main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE)
  12. # gcc $(DEFINES) $(INCLUDES) -N main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE)
  13. @echo "--- End of Compilation ---------------"
  14. strip $(PROGNAME)
  15. c:MakeDir Releases/$(ARCHDIR)/Catalogs/Dutch FORCE ALL
  16. c:Move $(PROGNAME) TO Releases/$(ARCHDIR) QUIET
  17. c:Copy Releases/$(PROGNAME).info TO Releases/$(ARCHDIR) QUIET
  18. # c:Copy $(ARCHIVE) TO Releases/$(ARCHDIR) QUIET
  19. c:Copy Catalogs/catalog.cd TO Releases/$(ARCHDIR)/Catalogs
  20. c:Copy Catalogs/dutch/$(PROGNAME).catalog TO Releases/$(ARCHDIR)/Catalogs/Dutch
  21. @CD Releases
  22. @CD
  23. c:lha a -r $(ARCHNAME) $(ARCHDIR)/#?
  24. # c:lha a -r Releases/$(ARCHNAME) Releases/$(ARCHDIR)/#?
  25. # c:Delete $(ARCHDIR)
  26. @echo "=== Done making archive =============="

The building of the archive results now in this (console-)output:

  1. gcc -DPROGNAME="AlignWindows" -DPROGREVN="0" -DPROGVERS="2" -DCOMPVERS="GCC_11.2.0" -DSDKVERS="V54.16" -DUSE_WBRUN -DUSE_CLIRUN -DUSE_SINGLERUNNING -DUSE_ARGUMENTS -N main.c -o AlignWindows -Wall -Wextra -Winline -Wunreachable-code -Wstack-protector -Wimplicit-fallthrough=0 -funsigned-bitfields -Os
  2. --- End of Compilation ---------------
  3. strip AlignWindows
  4. c:MakeDir Releases/AlignWindows_V2.0/Catalogs/Dutch FORCE ALL
  5. c:Move AlignWindows TO Releases/AlignWindows_V2.0 QUIET
  6. c:Copy Releases/AlignWindows.info TO Releases/AlignWindows_V2.0 QUIET
  7. c:Copy Catalogs/catalog.cd TO Releases/AlignWindows_V2.0/Catalogs
  8. c:Copy Catalogs/dutch/AlignWindows.catalog TO Releases/AlignWindows_V2.0/Catalogs/Dutch
  9. Development 1:Software Development/C-Projects/CurrentProjects/AlignWindows
  10. c:lha a -r AlignWindows_V2.0.lha AlignWindows_V2.0/#?
  11. LhA Freeware Version 2.15 AOS4
  12. Copyright (c) 1991-94 by Stefan Boberg.
  13. Copyright (c) 1998,1999 by Jim Cooper and David Tritscher.
  14. Copyright (c) 2004-2011 by Sven Ottemann.
  15.  
  16. *** LhA: No files match action pattern(s)!
  17.  
  18.  
  19. c:lha faalt returncode 20
  20. Make: *** [create_archive] Error 20

It seems that the line @CD Releases has no effect., as shown by this line in the output:

  1. Development 1:Software Development/C-Projects/CurrentProjects/AlignWindows

which SHOULD have read:

  1. Development 1:Software Development/C-Projects/CurrentProjects/AlignWindows/Releases

, but it doesn't.

I used to use this sequence when in the stadium of archiving:

  1. c:lha a -r Releases/$(ARCHNAME) Releases/$(ARCHDIR)/#?

This 'worked', but prefixed the (desired) path with 'Releases' (arguably!). And that's then my gripe.

Any solution?

OldFart

Rigo
Rigo's picture
Offline
Last seen: 9 hours 12 min ago
Joined: 2011-01-24 21:55
Re: Building an Archive (.lha)

Strangely, after quite a few tests, it appears that "cd" simply doesn't work in conjunction with "make".

It does, however, work with "gmake". The only drawback here is that you may have to convert your paths into unix format.

arc:
cd Releases; \
lha blah ....

Note how the commands are combined, which is important. See below.

Also, check out the "&&" directive to combine commands only when the last one succeeds. ie:

arc:
cd Releases && lha blah ....

This may be important because it turns out that "cd" is spawned in a different shell process. Therefore, unless the commands are combined, the change of path will not be reflected when the next command executes, as it is in a different shell process using the current directory from "make". You might want to checkout the .ONESHELL directive to stop the shell spawning.

Anyway, enough talking! Here's a very simple example of archiving files in a sub-directory. Save this as ram:makefile and run it with "gmake".

  1. .PHONY: arc
  2.  
  3. arc:
  4. cd t && \
  5. lha a -r test.lha #?

In this example, the archiving will only happen if the change of directory was successful.

Simon

jabirulo
jabirulo's picture
Offline
Last seen: 17 hours 15 min ago
Joined: 2013-05-30 00:53
Re: Building an Archive (.lha)
  1. #list Releases
  2. Directory "Releases" a Sábado 22-Nov-25
  3. AlignWindows_V2.0 Dir ----rwed Hoy 12:04:03
  4. 1 directory
  5.  
  6. #c:lha a -r tes01 Releases/
  7. LhA Freeware Version 2.15 AOS4
  8. Copyright (c) 1991-94 by Stefan Boberg.
  9. Copyright (c) 1998,1999 by Jim Cooper and David Tritscher.
  10. Copyright (c) 2004-2011 by Sven Ottemann.
  11.  
  12. Creating new archive 'tes01.lha':
  13. Frozen: ( 57.5%) 46672 => 19795 : AlignWindows_V2.0/AlignWindows
  14. Frozen: ( 7.2%) 2352 => 2181 : AlignWindows_V2.0/AlignWindows.info
  15. Frozen: ( 57.4%) 1509 => 642 : AlignWindows_V2.0/Archiving
  16. Frozen: ( 51.2%) 1010 => 492 : AlignWindows_V2.0/Catalogs/catalog.cd
  17. Frozen: ( 42.3%) 906 => 522 : AlignWindows_V2.0/Catalogs/Dutch/AlignWindows.catalog
  18. 5 files added, all files OK.
  19.  
  20. Operation successful.
  21.  
  22. #lha v tes01.lha
  23. LhA Freeware Version 2.15 AOS4
  24. Copyright (c) 1991-94 by Stefan Boberg.
  25. Copyright (c) 1998,1999 by Jim Cooper and David Tritscher.
  26. Copyright (c) 2004-2011 by Sven Ottemann.
  27.  
  28. Listing of archive 'tes01.lha':
  29. Original Packed Ratio Date Time Name
  30. -------- ------- ----- --------- -------- -------------
  31. 46672 19795 57.5% 21-Nov-25 19:42:52 AlignWindows_V2.0/AlignWindows
  32. 2352 2181 7.2% 21-Nov-25 19:42:52 AlignWindows_V2.0/AlignWindows.info
  33. 1509 642 57.4% 18-Nov-25 15:31:30 AlignWindows_V2.0/Archiving
  34. 1010 492 51.2% 21-Nov-25 19:42:52 AlignWindows_V2.0/Catalogs/catalog.cd
  35. 906 522 42.3% 21-Nov-25 19:42:52 AlignWindows_V2.0/Catalogs/Dutch/AlignWindows.catalog
  36. -------- ------- ----- --------- --------
  37. 52449 23632 54.9% 22-Nov-25 12:07:38 5 files
  38.  
  39. Operation successful.
  40.  
  41. #

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonRX550/SSD240GB/DVDRW :-P

Log in or register to post comments