Author Topic: Makefile target parsing and "Execute Makefile Target"  (Read 3511 times)

Mr68360

  • Community Member
  • Posts: 46
  • Hero Points: 3
Makefile target parsing and "Execute Makefile Target"
« on: March 26, 2008, 09:05:43 pm »
I have several makefiles with multiple targets defined:

clean:
      do the clean

all default program:
      do some commands for all, default, or program

When I select the "Execute Makefile Target" from the build menu, only 'clean' shows up as a possible target.  I confirmed that the SlickEdit parser is finding only single-word targets ending with a ':'.  Thus, 'clean' shows up, but 'all', 'default', and 'program' do not.

Could someone point to the macro code that does the parsing so I can noodle around and try to modify the parser so that it finds all targets on a line?

If handling multiple targets on a line is a feature worth pursuing, I'd appreciate the SlickEdit staff doing so.

Thanks! (in advance).

Chuck


hs2

  • Senior Community Member
  • Posts: 2749
  • Hero Points: 289
Re: Makefile target parsing and "Execute Makefile Target"
« Reply #1 on: March 26, 2008, 09:19:46 pm »
Have a look at:
projutil.e - _makefile_GetTargetList()
and perhaps:
tags.e - mak_proc_search()
Good luck, HS2

David_O

  • Senior Community Member
  • Posts: 152
  • Hero Points: 8
Re: Makefile target parsing and "Execute Makefile Target"
« Reply #2 on: March 28, 2008, 04:16:31 pm »
SlickEdit 2008 will recognize multiple targets on a single line.  It will also handle more complicated macro substitutions.

Here is a sample I used to test.  (I know these are unusual target names.)

Code: [Select]
BOB = Alice
ob  = OB

JOE$(BOB)JOE : \
$@@  JOEAliceJoe

Jim Jeff :
@echo $@  double target

B${ob} :
@echo Bob is the target

$(B${ob}) :
@echo Alice is the target

Easy : Rob
@echo Easy

AAA = ${CCC}
BBB = $(AAA)
CCC = DDD

WW$(BBB)WW : target1
@echo This one is WWDDDWW

This will find the seven targets

JOEAliceJoe
Jim
Jeff
BOB
Alice
Easy
WWDDDWW

SlickEdit 2008 also will handle include statements.  Unfortunately, I was just checking feature for this post and found a bug in the handling of makefile include statements.  An include may hide the next following target in the original file.  We'll check this and if needed will fix for the next release/hotfix.

Hope this helps,