Recent

Author Topic: how to setup makefiles  (Read 1353 times)

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
how to setup makefiles
« on: July 26, 2024, 08:49:04 am »
I cloned the official fpc source.

1)
It's for me not allowed to push my branch.

How should I work the right way?
I was told to work on an different branch of the source not on main. Push my changes.

2)
And I have to setup the makefiles for compilation.

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
Re: how to setup makefiles
« Reply #1 on: July 28, 2024, 12:39:17 pm »
1) I was told to fork the official FPC source and create an own branch, so it can be easy merged to the source when finally finished

2) I'm parallel writing a doc about porting. The first step:

Code: Text  [Select][+][-]
  1. 1) Setup the make files
  2.  
  3.         add the new build target to fpcmake:
  4.  
  5.                 - You need to extend the ./utils/fpcm/fpcmmain.pp:
  6.  
  7.                         insert the new Target in
  8.  
  9.                                 type TOS=(..., ps1); section. (about line 100)
  10.  
  11.                                 don't forget to insert it also to OSStr(about line 135) and OSSufix(about line 144) constants.
  12.  
  13.                                 add at the end of the table OSCpuPossible a new os/cpu entry (about line 207)
  14.  
  15.  
  16.                         rebuild your native compiler
  17.                                 $make all
  18.                                 $sudo make install
  19.  
  20.                         now fpcmake can generate make files.
  21.  
  22.  
  23.         add to ./compiler/Makefile.fpc:
  24.                
  25.                 NO_NATIVE_COMPILER_OS_LIST (about line 44)
  26.                         your target system, ps1
  27.                 this indicates, there is no native compiler for your target
  28.  
  29.  
  30.         time to rebuild all make files:
  31.  
  32.           you have to run the fpcmake in all folders of the fpc sources
  33.           after that
  34.           to build the rtl make files you have to execute ./regenmakefiles.sh in ./rtl
  35.           to build the packages you have to execute ./regenmakefiles.sh in ./packages
  36.  
  37.           to simplify all touse steps execute my script
  38.                 $./mk.sh
  39.  

this mk.sh:
Code: Text  [Select][+][-]
  1.  #! /bin/sh
  2. set -e
  3. FPCMAKE=/usr/local/bin/fpcmake
  4.  
  5. find . -name Makefile.fpc | xargs $FPCMAKE -Tall
  6.  
  7. cd ./rtl
  8. ./regenmakefiles.sh
  9. cd ./..
  10.  
  11. cd ./packages
  12. ./regenmakefiles.sh
  13. cd ./..
  14.  
  15. cd ./utils/build/
  16. $FPCMAKE -Tall -s -o Makefile.pkg Makefile.fpc
  17. cd ./../..
  18.  
  19. cd ./packages/build/
  20. $FPCMAKE -Tall -s -o Makefile.pkg Makefile.fpc
  21. cd ./../..
  22.  


are this Steps correct? Did I forgot something?


My goal it to achieve the complete build cycle by using:
Code: Pascal  [Select][+][-]
  1. $make all CPU_TARGET=mipsel OS_TARGET=ps1 OPT="-O- -CR -glv" CROSSOPT="-O- -g-" ALLOW_WARNINGS=1

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
Re: how to setup makefiles
« Reply #2 on: July 28, 2024, 04:49:09 pm »
I putted the compiler together again, now on this brunch:

https://gitlab.com/Key-Real/source/-/tree/ps1


make all CPU_TARGET=mipsel OS_TARGET=ps1

tells me:
Code: Text  [Select][+][-]
  1. Compiling /run/media/key-real/E3AF-F107/code/source/packages/fcl-process/src/pipes.pp
  2. process.inc(82,7) Warning: Symbol "TProcess.ApplicationName" is deprecated
  3. process.inc(82,34) Warning: Symbol "TProcess.CommandLine" is deprecated
  4. process.inc(78,3) Note: Local variable "E2" not used
  5. processbody.inc(810,28) Warning: Symbol "TProcess.SetCommandLine" is deprecated
  6. processbody.inc(853,28) Warning: Symbol "TProcess.SetCommandLine" is deprecated
  7. processbody.inc(256,12) Error: Forward declaration not solved "DetectXTerm:System.AnsiString;"
  8. process.pp(103,1) Fatal: There were 1 errors compiling module, stopping
  9. Fatal: Compilation aborted
  10.  


I knew its not a make fault, but somebody has ideas?

Laksen

  • Hero Member
  • *****
  • Posts: 776
    • J-Software
Re: how to setup makefiles
« Reply #3 on: July 28, 2024, 05:25:33 pm »
https://gitlab.com/Key-Real/source/-/blob/ps1/packages/fcl-process/fpmake.pp#L28

You will likely have to exclude most other packages as well. Look for how it's done for the embedded target

Also your makefile regeneration step can be shortened to running "fpcmake -Tall -r" in the fpc root directory

TRon

  • Hero Member
  • *****
  • Posts: 3173
Re: how to setup makefiles
« Reply #4 on: July 28, 2024, 05:27:12 pm »
I cloned the official fpc source.

1)
It's for me not allowed to push my branch.

How should I work the right way?
I was told to work on an different branch of the source not on main. Push my changes.
Indeed you need to make a clone of the official sources in your own repo.

Then create a new branch, make your changes in that branch and commit those changes first locally then to your (own) remote repo.

Make sure the changes for each commit are clean, clear and made in small steps an which allows for someone else to follow exactly what you did. Accompany your commits with good descriptions.

It is best to split up several stages of the porting process into several commits so that in case there is an issue it can be detected early and easily.

If you want to then you can also use multiple branches on top of each other but that can over-complicate things.

You can then later do a merge request for someone in the team to review your changes and apply them. If there are issues then they usually will be mentioned and that you need to take care of them before the merge request is honoured (that is why it is a good idea to make small merge requests and break up your branch into different smaller commits, or even several branches).

The most important part is to try and not break any existing functionality (unless the breakage occurs in/at your own target)  :)

Merge requests will be accepted quicker when they are simple, clean/clear and small.
« Last Edit: July 28, 2024, 05:39:03 pm by TRon »
All software is open source (as long as you can read assembler)

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
Re: how to setup makefiles
« Reply #5 on: July 28, 2024, 06:20:05 pm »
https://gitlab.com/Key-Real/source/-/blob/ps1/packages/fcl-process/fpmake.pp#L28

You will likely have to exclude most other packages as well. Look for how it's done for the embedded target

no effect :(    still the same message

I done:
Code: Pascal  [Select][+][-]
  1. P.OSes:=AllOSes-[embedded,msdos,win16,go32v2,nativent,macosclassic,palmos,atari,zxspectrum,msxdos,amstradcpc,sinclairql,wasi,human68k,ps1];



Also your makefile regeneration step can be shortened to running "fpcmake -Tall -r" in the fpc root directory

If I do this the next

make all CPU_TARGET=mipsel OS_TARGET=ps1

tells me:
Code: Text  [Select][+][-]
  1. [key-real@koshka source]$ make all CPU_TARGET=mipsel OS_TARGET=ps1
  2. make compiler_cycle RELEASE=1
  3. make[1]: Entering directory '/run/media/key-real/E3AF-F107/code/source'
  4. make -C compiler cycle
  5. make[2]: Entering directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  6. make OS_TARGET=linux CPU_TARGET=x86_64 CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 CYCLELEVEL=1 rtlclean
  7. make[3]: Entering directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  8. make -C /run/media/key-real/E3AF-F107/code/source/rtl clean
  9. make[4]: Entering directory '/run/media/key-real/E3AF-F107/code/source/rtl'
  10. /usr/bin/rm -f fpcmade.x86_64-linux *x86_64-linux.fpm Package.fpc *.s
  11. /usr/bin/rm -f   script*.res link*.res *_script.res *_link.res
  12. /usr/bin/rm -f ./ppas.sh *_ppas.sh ppas.sh ppaslink.sh
  13. make -C linux clean
  14. make[5]: Entering directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  15. /usr/bin/rm -f /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/abitag.o
  16. /usr/bin/rm -f /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/si_prc.ppu /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/si_c.ppu /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/si_g.ppu /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/si_dll.ppu
  17. /usr/bin/rm -f
  18. /usr/bin/rm -f fpcmade.x86_64-linux *x86_64-linux.fpm Package.fpc *.s
  19. /usr/bin/rm -f   script*.res link*.res *_script.res *_link.res
  20. /usr/bin/rm -f ./ppas.sh *_ppas.sh ppas.sh ppaslink.sh
  21. make[5]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  22. make[4]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/rtl'
  23. make[3]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  24. make OS_TARGET=linux CPU_TARGET=x86_64 CROSSBINDIR= BINUTILSPREFIX= CROSSCYCLEBOOTSTRAP=1 CYCLELEVEL=1 rtl
  25. make[3]: Entering directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  26. make -C /run/media/key-real/E3AF-F107/code/source/rtl 'OPT=' all
  27. make[4]: Entering directory '/run/media/key-real/E3AF-F107/code/source/rtl'
  28. make -C linux all
  29. make[5]: Entering directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  30. make /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux
  31. make[6]: Entering directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  32. make[6]: '/run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux' is up to date.
  33. make[6]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  34. as --64 -o /run/media/key-real/E3AF-F107/code/source/rtl/units/x86_64-linux/abitag.o x86_64/abitag.as
  35. make[5]: *** No rule to make target '.ppu', needed by 'si_prc.ppu'.  Stop.
  36. make[5]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/rtl/linux'
  37. make[4]: *** [Makefile:2367: linux_all] Error 2
  38. make[4]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/rtl'
  39. make[3]: *** [Makefile:5511: rtl] Error 2
  40. make[3]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  41. make[2]: *** [Makefile:5410: cycle] Error 2
  42. make[2]: Leaving directory '/run/media/key-real/E3AF-F107/code/source/compiler'
  43. make[1]: *** [Makefile:3266: compiler_cycle] Error 2
  44. make[1]: Leaving directory '/run/media/key-real/E3AF-F107/code/source'
  45. make: *** [Makefile:3298: build-stamp.mipsel-ps1] Error 2
  46.  

have to do:
Code: Text  [Select][+][-]
  1. $make clean
  2. $./mk.sh
  3.  
only this helps
« Last Edit: July 28, 2024, 06:25:45 pm by Key-Real »

Laksen

  • Hero Member
  • *****
  • Posts: 776
    • J-Software
Re: how to setup makefiles
« Reply #6 on: July 28, 2024, 07:38:05 pm »
Have you tried to clean completely before you regenerate the makefiles?

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
Re: how to setup makefiles
« Reply #7 on: July 28, 2024, 07:47:52 pm »
Have you tried to clean completely before you regenerate the makefiles?

Yes, still the same error

Key-Real

  • Sr. Member
  • ****
  • Posts: 362
Re: how to setup makefiles
« Reply #8 on: July 29, 2024, 10:01:18 pm »
I'm very far progressed with the compiler port. :)

It would be very cool to master this step.
I don't really understand the building process, pls help!
Need a good guide

 

TinyPortal © 2005-2018