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):
ARCHDIR = $(PROGNAME)_V$(PROGVERS).$(PROGREVN) ARCHNAME = $(ARCHDIR).lha #ARCHNAME = $(PROGNAME).lha #ARCHNAME = $(PROGNAME)_V$(PROGVERS).$(PROGREVN).lha DESTIN = "Releases/$(ARCHDIR)/$(PROGNAME)" .PHONY: create_archive create_archive: gcc $(DEFINES) $(INCLUDES) -N main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE) # gcc $(DEFINES) $(INCLUDES) -N ../../../main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE) # gcc $(DEFINES) $(INCLUDES) -N main.c -o $(PROGNAME) $(CFLAGS) $(FFLAGS) $(OPTIMIZE) @echo "--- End of Compilation ---------------" strip $(PROGNAME) c:MakeDir Releases/$(ARCHDIR)/Catalogs/Dutch FORCE ALL c:Move $(PROGNAME) TO Releases/$(ARCHDIR) QUIET c:Copy Releases/$(PROGNAME).info TO Releases/$(ARCHDIR) QUIET # c:Copy $(ARCHIVE) TO Releases/$(ARCHDIR) QUIET c:Copy Catalogs/catalog.cd TO Releases/$(ARCHDIR)/Catalogs c:Copy Catalogs/dutch/$(PROGNAME).catalog TO Releases/$(ARCHDIR)/Catalogs/Dutch @CD Releases @CD c:lha a -r $(ARCHNAME) $(ARCHDIR)/#? # c:lha a -r Releases/$(ARCHNAME) Releases/$(ARCHDIR)/#? # c:Delete $(ARCHDIR) @echo "=== Done making archive =============="
The building of the archive results now in this (console-)output:
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 --- End of Compilation --------------- strip AlignWindows c:MakeDir Releases/AlignWindows_V2.0/Catalogs/Dutch FORCE ALL c:Move AlignWindows TO Releases/AlignWindows_V2.0 QUIET c:Copy Releases/AlignWindows.info TO Releases/AlignWindows_V2.0 QUIET c:Copy Catalogs/catalog.cd TO Releases/AlignWindows_V2.0/Catalogs c:Copy Catalogs/dutch/AlignWindows.catalog TO Releases/AlignWindows_V2.0/Catalogs/Dutch Development 1:Software Development/C-Projects/CurrentProjects/AlignWindows c:lha a -r AlignWindows_V2.0.lha AlignWindows_V2.0/#? LhA Freeware Version 2.15 AOS4 Copyright (c) 1991-94 by Stefan Boberg. Copyright (c) 1998,1999 by Jim Cooper and David Tritscher. Copyright (c) 2004-2011 by Sven Ottemann. *** LhA: No files match action pattern(s)! c:lha faalt returncode 20 Make: *** [create_archive] Error 20
It seems that the line @CD Releases has no effect., as shown by this line in the output:
Development 1:Software Development/C-Projects/CurrentProjects/AlignWindows
which SHOULD have read:
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:
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

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".
In this example, the archiving will only happen if the change of directory was successful.
Simon
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonRX550/SSD240GB/DVDRW :-P