automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

building executables with pattern rules


From: Will Estes
Subject: building executables with pattern rules
Date: Mon, 14 Jul 2014 13:49:22 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

I have the following in my Makefile.am, and automake is not using the rule to 
build the executable.

tableopts_nr%.c: tableopts.l4
        $(FLEX) -P $(subst -,_,$(*F)) $* -o $@ $<

tableopts_nr%.$(OBJEXT): tableopts_nr%.c
        $(COMPILE) -c -o $@ $<

tableopts_nr%.tableopts$(EXEEXT): tableopts_nr.$(OBJEXT)
        $(LINK) $^

The % is matching various things like -Ca and so on that are options to flex 
for different kinds of tables that flex can produce. This is in the test suite 
and I've generated the long list of _SOURCES variables and the programs are 
listed in CHECK_PROGRAMS and TESTS.

The .tableopts  suffix is present because I'm using the parallel test harness 
to distinguish between various kinds of tests in the flex test suite that need 
different kinds of arguments when they're run.

THe output from trying to build the program with the Makefile.am as above looks 
like this:

/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o 
tableopts_nr-Ca.tableopts   -lm 
libtool: link: gcc -g -O2 -o tableopts_nr-Ca.tableopts  -lm
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o: In function 
`_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status

As a test, I did try explicitly listing tableopts_nr-Ca.tableopts$(EXEEXT) as a 
target and make did build the program correctly.

How do I get automake to recognize my pattern rule? Or, if there's another way 
to do this that's easier / better, what is that?

Thanks,

--Will



reply via email to

[Prev in Thread] Current Thread [Next in Thread]