diff --git a/app/src/tok.l/Makefile b/app/src/tok.l/Makefile deleted file mode 100644 index 6c4530f..0000000 --- a/app/src/tok.l/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -PAR=-O3 -m32 -#-static - -tok: tok.c cmdline.c - cc $(PAR) tok.c cmdline.c -o tok - -tok.c: tok.l - flex -8 -f -otok.c tok.l - -cmdline.c cmdline.h: cmdline_tok.ggo - gengetopt -i cmdline_tok.ggo --conf-parser - -clean: - rm *.c - rm cmdline.* - rm tok - -copy: tok -ifdef UTT_BIN_DIR - cp tok ${UTT_BIN_DIR} -endif diff --git a/auto/output/Makefile b/auto/output/Makefile index b1fc037..f76817a 100755 --- a/auto/output/Makefile +++ b/auto/output/Makefile @@ -2,7 +2,7 @@ cat << EOF > Makefile # Default target -.DEFAULT: all +.DEFAULT_GOAL = all SHELL = $SHELL CC = $CC @@ -43,16 +43,24 @@ ALL_FFLAGS = -t \$(FFLAGS) VPATH = ./src PROGRAMS = tok + TOK_OBJ_FILES = tok.o tok_cmdline.o TOK_FLEX_FILES = tok.l +TOK_GGO_FILES = tok_cmdline.ggo +tok.o: tok_cmdline.h + CONFIG_FILES = src/config.h Makefile .SUFFIXES: .SUFFIXES: .l .y .h .c .o +.INTERMEDIATE: \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) +.INTERMEDIATE: \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) +.INTERMEDIATE: \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) + .PHONY: all all: \$(PROGRAMS) - #make -C app compile + .PHONY: help help: @@ -69,7 +77,8 @@ clean: \$(RM) \$(PROGRAMS) \$(RM) \$(TOK_OBJ_FILES) \$(RM) \$(patsubst %.l,%.c,\$(TOK_FLEX_FILES)) - #make -C app clean + \$(RM) \$(patsubst %.ggo,%.c,\$(TOK_GGO_FILES)) + \$(RM) \$(patsubst %.ggo,%.h,\$(TOK_GGO_FILES)) .PHONY: distclean distclean: clean @@ -86,9 +95,15 @@ uninstall: %.o: %.c \$(CC) -c \$< -o \$@ \$(ALL_CFLAGS) -%.o: %.l +%.c: %.l \$(FLEX) -t \$< > \$@ +%.c: %.ggo + gengetopt --input $< --file-name \$(patsubst %.c,%,\$@) --conf-parser + +%.h: %.ggo + gengetopt --input $< --file-name \$(patsubst %.h,%,\$@) --conf-parser + %: %.o \$(CC) \$? -o \$@ \$(ALL_LDFLAGS) \$(ALL_CFLAGS) \$(ALL_LDLIBS) diff --git a/app/src/tok.l/tok.l b/src/tok.l similarity index 91% rename from app/src/tok.l/tok.l rename to src/tok.l index 39b9199..3dbbe5a 100644 --- a/app/src/tok.l/tok.l +++ b/src/tok.l @@ -1,7 +1,7 @@ %{ #include #include - #include "cmdline.h" + #include "tok_cmdline.h" int filepos=0; @@ -55,12 +55,13 @@ %% -main(int argc, char** argv) +int main(int argc, char** argv) { - if (cmdline_parser(argc, argv, &args) != 0) exit(1); + if (cmdline_parser(argc, argv, &args) != 0) return 1; setlocale(LC_CTYPE,""); setlocale(LC_COLLATE,""); yylex(); + return 0; } int yywrap() diff --git a/app/src/tok.l/cmdline_tok.ggo b/src/tok_cmdline.ggo similarity index 100% rename from app/src/tok.l/cmdline_tok.ggo rename to src/tok_cmdline.ggo