Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YACC=bison
- YFLAGS=-t
- CFLAGS=-g
- LEX=flex
- .SUFFIXES: _lex.c _yacc.c
- .l_lex.c :
- $(LEX) $(LFLAGS) -t $< > $@
- %.c : %.y
- # Cancel this rule, and create our own
- .y_yacc.c :
- $(YACC) $(YFLAGS) -d $< -o $@
- all: olmenu
- olmenu_lex_test.c : olmenu.l olmenu_tokens.y
- $(YACC) $(YFLAGS) -d olmenu_tokens.y
- mv olmenu_tokens.tab.h olmenu_yacc.h
- $(LEX) -d -t olmenu.l > $@
- olmenu_lex_test : olmenu_lex_test.c
- $(CC) $(CFLAGS) -DTEST_LEX $< -o $@ -ll
- olmenu-proto1_yacc.c : olmenu-proto1.y
- $(YACC) $(YFLAGS) -d $< -o $@
- mv olmenu-proto1_yacc.h olmenu_yacc.h
- olmenu-proto1 : olmenu-proto1_yacc.o olmenu_lex.o
- $(CC) -o $@ olmenu-proto1_yacc.o olmenu_lex.o
- olmenu-proto2_yacc.c : olmenu-proto2.y
- $(YACC) $(YFLAGS) -d $< -o $@
- mv olmenu-proto2_yacc.h olmenu_yacc.h
- olmenu-proto2 : olmenu-proto2_yacc.o olmenu_lex.o
- $(CC) -o $@ olmenu-proto2_yacc.o olmenu_lex.o
- olmenu : olmenu_yacc.o olmenu_lex.o dtwmrc.o
- $(CC) -o $@ olmenu_yacc.o olmenu_lex.o dtwmrc.o
- olmenu_yacc.o : olmenu_yacc.c olmenu.h
- olmenu_lex.o : olmenu_lex.c olmenu_yacc.h
- dtwmrc.o : dtwmrc.c olmenu.h olmenu_yacc.h
- clean :
- rm -f *_yacc.[ch] *_lex.c *.o *.tab.[ch] *_yacc.output olmenu_lex_test.c
- ```
- when invoking ```make olmenu-proto1```, it prints:
- ```
- bison -t -d olmenu-proto1.y -o olmenu-proto1_yacc.c
- mv olmenu-proto1_yacc.h olmenu_yacc.h
- cc -g -c -o olmenu-proto1_yacc.o olmenu-proto1_yacc.c
- olmenu-proto1.y: In function ‘main’:
- olmenu-proto1.y:154:25: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default]
- exit(1);
- ^
- flex -t olmenu.l > olmenu_lex.c
- cc -g -c -o olmenu_lex.o olmenu_lex.c
- olmenu.l: In function ‘yylex’:
- olmenu.l:109:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
- <ENV>[^$]+ return((int)yytext);
- ^
- olmenu.l:119:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
- if (s!=NULL) return((int)s);
- ^
- olmenu.l:125:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
- if (s!=NULL) return((int)s);
- ^
- olmenu.l: In function ‘expand_env’:
- olmenu.l:185:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
- seglen = strlen(segment);
- ^
- cc -o olmenu-proto1 olmenu-proto1_yacc.o olmenu_lex.o
- /*olmenu.l*/
- %{
- #include "olmenu_yacc.h"
- #include <math.h>
- #include <string.h>
- #ifndef YYLTYPE_IS_DECLARED
- typedef struct { int first_line; } yyltype;
- #define YYLTYPE yyltype
- #endif
- #ifdef TEST_LEX
- YYSTYPE yylval;
- YYLTYPE yylloc;
- #else
- extern YYLTYPE yylloc;
- #define YY_USER_INIT yylloc.first_line=1;
- #endif
- static char rcsid[] = "$Id: olmenu.l,v 1.1.1.1 1999/09/26 12:34:39 mib Exp $";
- %}
- %x CMD
- %s ACT
- %x ENV ENV1 ENV2
- ID ([A-Za-z_$/.0-9-]+)
- QSTR ("[^n"]*")
- %%
- BACK_SELN return(BACK_SELN);
- COLUMNS return(COLUMNS);
- DEFAULT return(DEFAULT);
- DIRMENU return(DIRMENU);
- END return(END);
- EXIT return(EXIT);
- EXIT_NO_CONFIRM return(EXIT_NO_CONFIRM);
- FLIPDRAG return(FLIPDRAG);
- FLIPFOCUS return(FLIPFOCUS);
- FULL_RESTORE_SIZE_SELN return(FULL_RESTORE_SIZE_SELN);
- INCLUDE return(INCLUDE);
- MENU return(MENU);
- MOVE_DESKTOP return(MOVE_DESKTOP);
- NOP return(NOP);
- OPEN_CLOSE_SELN return(OPEN_CLOSE_SELN);
- QUIT_SELN return(QUIT_SELN);
- PIN return(PIN);
- PROPERTIES return(PROPERTIES);
- REFRESH return(REFRESH);
- REREAD_MENU_FILE return(REREAD_MENU_FILE);
- RESTART return(RESTART);
- SAVE_WORKSPACE return(SAVE_WORKSPACE);
- SEPARATOR return(SEPARATOR);
- START_DSDM return(START_DSDM);
- STICK_UNSTICK_SELN return(STICK_UNSTICK_SELN);
- STOP_DSDM return(STOP_DSDM);
- TITLE return(TITLE);
- WINMENU return(WINMENU);
- WMEXIT return(WMEXIT);
- [0-9]+ {
- yylval.num = atoi(yytext);
- return(INT);
- }
- <ACT>({ID}|{QSTR})+ {
- BEGIN CMD;
- yymore();
- }
- ({ID}|{QSTR})+ {
- BEGIN ACT;
- yylval.str = strdup(yytext);
- return(LABEL); /* Label, with quotes */
- }
- <CMD>\n {
- yylloc.first_line++;
- yymore();
- }
- <CMD>n {
- yylval.str = strdup(yytext);
- yylval.str[yyleng-1] = '