English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language

 
 
Thread Tools
Old 26 February 2022, 09:27   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Make file questions

I have observed some anomalies in my make files so I am trying to replicate the problems in smaller problems to understand what I am doing wrong.

The first problem I have is that when I do a change make will build the object file but does not recompile the executable.

So I have created a simple project with just a main.c which prints hello world and this is my make file;
Code:
CC=vc +aos68k
COPT = 
LIBS = -lamiga -lauto

all: App

%.o : %.c
    vc -c -o $@ $<

App : main.o
    vc $^ -o $@ $(LIBS)

clean:
    -delete main.o APP
When I build the first time the main object file is built and the executable file is built. But if I do a change in main.c then only the main object file is re-built. The executable does not get rebuilt.

However I have other make files where the executable is re-built each time and the only difference is I moved the source files in /src and the build files in /build and the executable file in /bin. Just doing one of these does not seem to work, it seems the three of them needs to be done for the executable to be re-built. After this change, however, even without any changes the executable is rebuilt each time. Here is the second make file;
Code:
CC=vc +aos68k
COPT = 
LIBS = -lamiga -lauto

all: folder App

folder: 
	-makedir build
	-makedir bin

build/%.o : src/%.c
	vc -c -o $@ $<

App : build/main.o
	vc $^ -o bin/$@ $(LIBS)

clean:
	-delete build/main.o bin/App
Is this normal? Or there is something wrong with my make file?

Last edited by Sim085; 26 February 2022 at 09:37.
Sim085 is offline  
Old 26 February 2022, 11:08   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
The first example works perfectly for me. App is rebuilt whenever I change main.c.

Make sure the system clock is running properly. If a new .o file is older than the existing App file, it will not be relinked. This often happens if the source directory is on a NAS server (connected via SMBFS) and the time zone is not set up correctly. Or if the system clock is running too fast and after a reboot time has been set back. Or if there is no RTC and after a reboot the clock has been set back to a very old date.

Also make sure that all file names are written with proper case as given in the makefile. Names in makefiles are case sensitive.

Finally make sure that dependencies are specified correctly. For example a mistake I often make is

main.c: something.h

instead of

main.o: something.h
thomas is offline  
Old 27 February 2022, 01:09   #3
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
Good to know the script should be good.



I am using FS-UAE on Mac. Will try the same script on WinUAE when I have access to my Windows machine.



Quote:
Originally Posted by thomas View Post
The first example works perfectly for me. App is rebuilt whenever I change main.c.

Make sure the system clock is running properly. If a new .o file is older than the existing App file, it will not be relinked. This often happens if the source directory is on a NAS server (connected via SMBFS) and the time zone is not set up correctly. Or if the system clock is running too fast and after a reboot time has been set back. Or if there is no RTC and after a reboot the clock has been set back to a very old date.

Also make sure that all file names are written with proper case as given in the makefile. Names in makefiles are case sensitive.

Finally make sure that dependencies are specified correctly. For example a mistake I often make is

main.c: something.h

instead of

main.o: something.h
Sim085 is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to make HDF file with PSF3 but it not showing on the Workbench spannernick support.WinUAE 11 24 September 2023 18:45
How do you make a .info file..? spannernick support.Apps 3 21 May 2012 01:33
Possible to make a hard-file seem like a CD? Welshieinnz support.WinUAE 5 02 August 2008 12:46
How do I make an iso file? nikvest support.Other 2 08 September 2006 11:35
Want to make a CAPS IPF file. How? TjLaZer support.Games 3 24 March 2005 13:46

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:33.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08088 seconds with 13 queries