Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Makefile's install depends on all
Makefile's install depends on all [message #44504] Thu, 19 March 2015 06:03 Go to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
I use command line umk to build.
I wonder from where I got this Makefile.
first I run make, which will build "all".
Then I run make install. It relies on "all". "all" will complain ${program_name} already exists, which IS the former result.
"install" should depends on "all" but use its result if it has been run.

And, I wonder why "install" needs gawk, which is not needed when I compile anything in theide.
  • Attachment: Makefile
    (Size: 3.80KB, Downloaded 84 times)

[Updated on: Thu, 19 March 2015 06:59]

Report message to a moderator

Re: Makefile's install depends on all [message #44505 is a reply to message #44504] Thu, 19 March 2015 07:05 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

Hi bonami,

bonami wrote on Thu, 19 March 2015 06:03
I use command line umk to build.
first I run make, which will build "all".
Then I run make install. It relies on "all". "all" will complain ${program_name} already exists, which IS the former result.
"install" should depends on "all" but use its result if it has been run.


Did you write the Makefile? It seems quite overcomplicated, I couldn't really figure out what should all the shell command in the targets actually do. But what I see at first sight is that there are no dependencies at all. So make have no idea that your application was already built, when running install and tries to build it again. You have to list the files that are created by each target as its dependencies. For example:
all: ${program_name}

This should fix your problem. It would also probably allow you to simplify the makefile a lot. GNU Make is a great tool with lots of possibilities, if you haven't read any of it's documentation you probably should Wink

bonami wrote on Thu, 19 March 2015 06:03
And, I wonder why "install" needs gawk, which is not needed when I compile anything in theide.
Because you're using it on line 73:
	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
	    else { print "f", $$3 "/" $$4, $$1; } } \
	  END { for (d in files) print "f", d, files[d] }'


Best regards,
Honza
Re: Makefile's install depends on all [message #44506 is a reply to message #44505] Thu, 19 March 2015 07:56 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
It is a strange makefile.
Isn't there a universal Makefile for umk?
I added your suggestion as dependency and changed it as the following. It is better.
all: ${program_name}

${program_name}: ${code_files}
         @echo building...; \

[Updated on: Thu, 19 March 2015 08:35]

Report message to a moderator

Re: Makefile's install depends on all [message #44507 is a reply to message #44506] Thu, 19 March 2015 08:48 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

bonami wrote on Thu, 19 March 2015 07:56
It is a strange makefile.

Then why are you using it? You can write better one Smile

bonami wrote on Thu, 19 March 2015 07:56
Isn'
I added your suggestion as dependency and changed it as the following. It is better.
all: ${program_name}

${program_name}: ${code_files}
         @echo building...; \
t there a universal Makefile for umk?

There is a universal makefile for U++ that doesn't need umk at all Smile Search the forum. I am using it to build U++ packages.

Honza
Re: Makefile's install depends on all [message #44526 is a reply to message #44507] Mon, 23 March 2015 02:43 Go to previous messageGo to next message
bonami is currently offline  bonami
Messages: 186
Registered: June 2007
Location: Beijing
Experienced Member
I think you meant https:// code.google.com/p/upp-mirror/source/browse/trunk/uppbox/lpbu ild2/mkfile
I did not mention it because I cannot understand it. Don't know how to migrate it, since its parameters include package, etc. Plus, it has no "dist" target?
Re: Makefile's install depends on all [message #44527 is a reply to message #44526] Mon, 23 March 2015 06:21 Go to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

bonami wrote on Mon, 23 March 2015 02:43
I think you meant https:// code.google.com/p/upp-mirror/source/browse/trunk/uppbox/lpbu ild2/mkfile
I did not mention it because I cannot understand it. Don't know how to migrate it, since its parameters include package, etc. Plus, it has no "dist" target?
Yes, that's it. I'm not sure what you mean by dist target, but it definitely doesn't have it. Also it has no install target, it only handles building. You can have a look on how it can be used at the other makefile in the same directory, which includes the general one to build theide and umk: https://code.google.com/p/upp-mirror/source/browse/trunk/upp box/lpbuild2/Makefile

Simpler example might be something like this (I haven't got time to actually test it, so sorry if there are some minor issues):
PKG=MyPackage
NESTS=mysrc uppsrc
FLAGS=GUI GCC DEBUG DEBUG_FULL STACKTRACE

build: MyPackage

# this is only needed if you want support parallel builds with dpkg-buildpackage -j
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    JOBS:=$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
else
    JOBS:=1
endif

OPTS:=CC="cc -g" CXX="c++ -g" CFLAGS="-g" CXXFLAGS="-g" LDFLAGS="-Wl,--gc-sections -Wl,-O,2" TIME= COLOR=0 USEMAINCFG=0
y
$(PKG):
        $(MAKE) -f mkfile JOBS=$(JOBS) PKG=$@ "NESTS=$(NESTS)" $(OPTS) "FLAGS=$(FLAGS)" TARGET=`pwd`/$@

install:
        install -D $(PKG) $(DESTDIR)/usr/bin/

clean:
        rm -f $(PKG)

Just edit the first three lines to suit your needs and place it to the same directory where the mkfile and you nests (mysrc and uppsrc in this exaple) are.

Honza
Previous Topic: umk fails on launchpad
Next Topic: apps built depends on libstdc++
Goto Forum:
  


Current Time: Sat Dec 14 20:27:39 CET 2019

Total time taken to generate the page: 0.01374 seconds