![]() |
![]() |
#1 |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 965
|
Small problem with makefile
I have a small problem with a make file. In summary in this project I am doing a copy of all code in source directory to a temp directory. I then do some place holder text replacements and finally I continue with compilation.
So for example, given /source/main.c, the make file will copy this to /temp/main.c, modify /temp/main.c and then compile from /temp/main.c. However the first time I run the make file it always gives me the error: No match for main.o No objects to link make: **** [Example] error 5 The second time I run the command it then works ok and continues to work until I run "make clean" (which deletes the temp directory). If I compile directly from source directory then the error does not happen. I am working on WinUAE (not sure if on real hardware the error happens or not). Anyone knows of what possible solution there is to resolve this? I can work around it (as second time and following that it compiles) but it is just annoying. |
![]() |
![]() |
#2 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 695
|
maybe there is an error in line 127 of your makefile...
... or you should always create the temp folder if it does not exist |
![]() |
![]() |
#3 |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 965
|
I do have a rule to always create the temp directory, and I can see the temp directory exists and source files have been moved to this.
The issue seems like a timing issue. Here are my rules: Code:
all: dirs copysrc MyApp dirs: -makedir temp -makedir bin copysrc: copy all source/ temp In summary the make file first tries to create the directory, than copy the source to temp and finally it tries to compile the solution. It seems that 'MyApp' is being evaluated before copysrc completes. |
![]() |
![]() |
#4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,498
|
The order is not "timing", the issue is that you seem to imply that the rules are executed in a specific order, but they are not. They only deffine logical dependencies. Thus, "dirs" should probably be "temp", because "make" can check whether "temp" exist, and "copysrc" should explicitly depend on "temp" because it needs the directory to exist to work.
|
![]() |
![]() |
#5 | |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 695
|
Quote:
Code:
all: copysrc MyApp .PHONY: dirs dirs: -makedir temp -makedir bin copysrc: dirs copy all source/ temp Code:
copysrc: mkdir -p temp copy all source/ temp |
|
![]() |
![]() |
#6 | |
Registered User
Join Date: Apr 2009
Location: N/A
Posts: 965
|
I have changed my makefile to this to make it simpler:
Code:
all: copy MyApp clean: -delete temp bin main.o MyApp all temp: -makedir temp copy: temp copy all source/ temp # SETDATE temp ALL - Did not work. # WAIT 10 SECS - Did not work. # RULE A %.o : temp/%.c $(CC) $(COPT) -c $< -o $@ # RULE B MyApp : main.o $(CC) $^ -o $@ $(LIBS) main.o: temp/main.h The output of the first run is as follows: Code:
System:example> make makedir temp copy all source/ temp COPY mode main.h ..copied main.c ..copied vc +aos68k main.o -o MyApp -lamiga -lauto -ldebug # RULE B No match for main.o No objects to link make: *** [MyApp] Error 5 Code:
COPY mode main.h ..copied main.c ..copied vc +aos68k -c temp/main.c -o main.o # RULE A vc +aos68k main.o -o MyApp -lamiga -lauto -ldebug # RULE B The only reason I can think of for this is that make is not detecting any changes happened to (in my case) temp/main.c and therefore does not run the associated command. I therefore tried SETDATE temp ALL (sort of like touch in Linux) but that did not work, same exact behavior. I cannot understand, everything seems to be running in order, directories created, source files copied but then that RULE is not being run first time but runs the second time ![]() Quote:
@bebbo, thank you for the scripts, I took some of the ideas in the above script. Tried PHONY too but did not seem to have an effect. Last edited by Sim085; Today at 11:06. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Small FastATA ZIV problem | utri007 | support.Hardware | 1 | 20 July 2021 16:43 |
Small problem with expansions setting page | mark_k | support.WinUAE | 1 | 22 June 2017 12:44 |
small problem with caracteres ?? | Alexfrench | project.ClassicWB | 3 | 04 June 2012 16:37 |
A small problem | clownstyle | New to Emulation or Amiga scene | 1 | 20 January 2004 20:47 |
small problem | pulley | support.Hardware | 2 | 05 November 2002 13:21 |
|
|