log in | register | forums


User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Archive Edition 27:2 reviewed (News:)
- RISC OS 5.30 arrives (News:3)
- Rougol May 2024 meeting on monday with Andy Vawer (News:1)
- WROCC May 2024 meeting - Gerph talks games (News:)
- Drag'n'Drop 13i3 edition reviewed (News:1)
- Wakefield Show 2024 in Pictures (News:5)
- April 2024 News Summary (News:2)
- Upgrading your RISC OS system to 5.30 (News:2)
- WROCC May 2024 meeting on wednesday - Gerph talks games (News:)
- uniprint upgraded to 4.50 (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
View on Mastodon
Site Search
Article archives
Acorn Arcade forums: Programming: Can oneUse flex in a GNU makefile?
  Can oneUse flex in a GNU makefile?
  Cauchy (17:30 25/2/2021)
John O'Meara Message #125093, posted by Cauchy at 17:30, 25/2/2021
Posts: 43
I have a file fbl-1.l, i.e., fbl-1 is in the l directory. At the CLI I type *flex fbl-1.l. This produces a file in the c directory called lex/yy. I remove the '/' character from the this file name to get lexyy. I then type at the CLI *gcc lexyy -lfl, to get the a/out file. Everything works fine. I put a work-around of those instructions into a makefile, but no joy with the flex command. The word-around instructions are as follows.
TestImage: lextest.o -lfl
gcc lextest.o -oTestImage

lextest.o: fbl-1.c
gcc -c fbl-1.c -o $@

fbl-1.c: fbl-1.l
flex -t fbl-1.l > fbl-1.c
When I run this makefile, the following is displayed:
flex -t fbl-1.l > fbl-1.c
/SCSI::SSD>$.Apps/DEvelopment/!Flex/flex: flex out: error closing output lex.yy.c
/SCSI::SSD.$.Apps/Development/!Flex/flex: error closing output file lex.yy.c
make: *** {test1make:16: fbl-1.c} Error 1
The thing is it produces the file c.fbl-1 but it is completely empty.
The file test1make is the name of the makefile and is run by typing at the * prompt: make --file=test1make
the file l.fbl-1 is a simple word count program. The reason I do not use the more simple commands flex fbl-1.l and gcc lex/yy -lfl, is that you cannot have '/' or '.' characters in a file name as to gcc lex/yy means the file yy in the directory lex, and gets translated as such into the RISC OS. The code in the file l.fbl-1 follows:
int chars = 0;
int words = 0;
int lines = 0;


[a-zA-Z}+ {words++; chars++; strlen(yytext); }
\n {chars++; lines++; }
. {chars++; }


main(int argc, char **argv)
printf(%8d%8d%8d\n", lines, words, chars);
Any ideas and help is welcome. Thanks alot.
If I change the line gcc -c fbl-1.c -o $@ to
gcc -c fbl-1.c -o lextest.o The message I get is:
gcc -c fbl-1.c -o lextest.o
make: *** No reule to make target '-lfl', needed by 'TestImage'. Stop.

[Edited by Cauchy at 23:16, 25/2/2021]
  ^[ Log in to reply ]

Acorn Arcade forums: Programming: Can oneUse flex in a GNU makefile?