Recent

Author Topic: Building with makefile issues  (Read 4988 times)

//DG

  • New Member
  • *
  • Posts: 17
Building with makefile issues
« on: October 09, 2016, 07:27:30 pm »
Hi, All!
Trying to compile a project for non-standard hobby OS and have couple of questions, most probably related to wrong paths.

There is a port of basic RTL for non-standard OS, modules for which are basically delivered as compiling to Win32 and then converting PE exe to format of that OS.

Right now I have following directory structure:
c:\lazarus\tmp\units\rtl - .o/.ppu files for basic RTL converted to use API of the non-standard OS
c:\lazarus\tmp\examples\src - example hello world program
c:\lazarus\tmp\examples - has makefile.fpc and makefile itself.
Makefile.fpc has sections:

[target]
programs=hello

[default]
target=win32
cpu=i386
fpcdir=C:\lazarus\fpc\3.0.0\source
unitdir=C:\lazarus\tmp\units

[compiler]
sourcedir=src
...
...

Hence, it points that sources must be looked up in .\src. But when I run make in the c:\lazarus\tmp\examples, I get an error "No rule to make target hello.exe needed by", but if i copy hello.pp into folder with makefile, it finds id.
Obviously, make doesn't look up file(s) in .\src directory. Why? How to resolve the issue?

Next, I see that make adds units dir from main FPC installation, hence:
-FuC:/lazarus/fpc/3.0.0/source/rtl/units/i386-win32
while I'd need it to pickup my RTL for another OS, which is in c:\lazarus\tmp\units\rtl\; obviously, fpcdir=C:\lazarus\fpc\3.0.0\source does interfer; should I model directory structure of "my" RTL as main one (/units/i386-win32) and point fpcdir to it?

« Last Edit: October 09, 2016, 07:29:53 pm by //DG »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Building with makefile issues
« Reply #1 on: October 09, 2016, 09:56:26 pm »
try OPTS=-n  to not read the config file, and then try to pass your own.

You might also want to add some verbosity options (like -va) and pipe the result


make  OPTS="-n -va" >output.txt

make  examples OPTS="-n -va" >output.txt

//DG

  • New Member
  • *
  • Posts: 17
Re: Building with makefile issues
« Reply #2 on: October 09, 2016, 09:59:21 pm »
try OPTS=-n  to not read the config file, and then try to pass your own.

You might also want to add some verbosity options (like -va) and pipe the result


make  OPTS="-n -va" >output.txt

make  examples OPTS="-n -va" >output.txt

Will try, thnx.
Which config file do you mean in particular? I though it works based on only makefile itself.

//DG

  • New Member
  • *
  • Posts: 17
Re: Building with makefile issues
« Reply #3 on: October 09, 2016, 10:02:37 pm »
Well, it is same:
make: *** No rule to make target `hello.exe', needed by `fpc_exes'.  Stop.

for first, and for make examples:
make: Nothing to be done for `examples'.

Feeling that I don't get something very simple about makefile. I though that specifying sourcedir would be enough.
« Last Edit: October 09, 2016, 10:08:27 pm by //DG »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11452
  • FPC developer.
Re: Building with makefile issues
« Reply #4 on: October 09, 2016, 10:11:30 pm »
Look at the examples in packages/ all end-binaries seem to be in exampledir.

Except maybe package "chm" that has installable EXE's.

Similarly in utils/ there also might be dirs with installable files.


//DG

  • New Member
  • *
  • Posts: 17
Re: Building with makefile issues
« Reply #5 on: October 09, 2016, 11:03:13 pm »
Look at the examples in packages/ all end-binaries seem to be in exampledir.

Except maybe package "chm" that has installable EXE's.

Similarly in utils/ there also might be dirs with installable files.

Packages seem to be built some other way, more complicated. For example, if I go to \packages\a52 and look at the makefile.fpc, it has following part:

fpmake$(SRCEXEEXT): fpmake.pp
   $(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
all:   fpmake$(SRCEXEEXT)
   $(LOCALFPMAKE) compile $(FPMAKE_OPT)

Meaning it will first build fpmake, and then continue building using it. The \src folder is referenced in the fpmake.pp.

My case is much simplier; I can add target hello.exe manually, but I supposed that it is enough to add 'hello' to 'programs', and sources to another section, like:
[target]
programs=hello
[compiler]
sourcedir=src


Cyrax

  • Hero Member
  • *****
  • Posts: 836
Re: Building with makefile issues
« Reply #6 on: October 10, 2016, 04:13:08 am »
You need to generate proper Makefile (that make understands) from Makefile.fpc. If I remember correctly, command line tool fpcmake.exe should do it.

You probably need to create customized [rules] section which contains rules for make build from src directory.

//DG

  • New Member
  • *
  • Posts: 17
Re: Building with makefile issues
« Reply #7 on: October 10, 2016, 11:52:01 am »
You need to generate proper Makefile (that make understands) from Makefile.fpc. If I remember correctly, command line tool fpcmake.exe should do it.

You probably need to create customized [rules] section which contains rules for make build from src directory.

Sure I do convert makefile.fpc to makefile, this is out of question.

I supposed that specifying src directory creates some sort of default rule, because if file hello.pp is in the same directory as makefile, it builds it.

//DG

  • New Member
  • *
  • Posts: 17
Re: Building with makefile issues
« Reply #8 on: October 12, 2016, 04:46:53 pm »
Noone has built fpc's by hand?

I suppose that if I have directory structure as follows:
.\makefile.fpc
.\makefile
.\src\hello.pp

then it is enough to have makefile.fpc like:
[target]
programs=hello

[default]
dir=src

[compiler]
unittargetdir=build
targetdir=bin
sourcedir=src

and fpcmake will automatically generate rule for building hello, because it is specified in "programs" (yes, FPCDIR variable is set).

Isn't it so?
« Last Edit: October 12, 2016, 05:07:41 pm by //DG »

 

TinyPortal © 2005-2018