scripts/addToolsVersion: properly handle .in vs. .in.2
While most components have their version in the .in file, some
have it in the .in.2 (eg. elf2flt).
Currently, to handle this case, we indiscriminately munge both files,
but this is wrong: in the elf2flt case, if we add a binutils version,
we do not want it to be added to elf2flt, and conversely.
So, for each tool, we need to explicitly know what file to munge.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
1 #-----------------------------------------------------------
3 # Or: where I can unveil my make-fu... :-]
6 @true # Just be silent, you fscking son of a fscking beach...
9 CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
12 # Compiler flags to use gettext
14 INTL_CFLAGS = -DKBUILD_NO_NLS
17 # Compiler and linker flags to use ncurses
18 NCURSES_CFLAGS = -DCURSES_LOC="\"$(curses_hdr)\""
19 NCURSES_LDFLAGS = $(LIBS)
22 COMMON_SRC = zconf.tab.c
23 COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
24 COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
25 $(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS) -I.
27 # lxdialog source files
28 LX_SRC = $(wildcard lxdialog/*.c)
29 LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
30 LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
31 $(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
33 # What's needed to build 'conf'
35 conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
36 conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
37 $(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
39 # What's needed to build 'mconf'
41 mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
42 mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
43 $(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
44 mconf: LDFLAGS += $(NCURSES_LDFLAGS)
46 # What's needed to build 'nconf'
47 nconf_SRC = nconf.c nconf.gui.c
48 nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
49 nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
50 $(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
51 nconf: LDFLAGS += -lmenu -lpanel -lncurses
53 # Under Cygwin, we need to auto-import some libs (which ones, exactly?)
54 # for mconf and nconf to lin properly.
55 ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
56 mconf: LDFLAGS += -Wl,--enable-auto-import
57 nconf: LDFLAGS += -Wl,--enable-auto-import
60 # These are generated files:
61 ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
62 ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
64 # Cheesy auto-dependencies
67 DEPS += $(mconf_DEP) $(LX_DEP)
71 # Build the dependency for C files
74 @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
76 # Generate the grammar parser
77 zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c
78 zconf.tab.dep: zconf.tab.c zconf.hash.c lex.zconf.c
80 .PRECIOUS: zconf.tab.c
83 @bison -l -b zconf -p zconf $<
85 zconf.hash.c: zconf.gperf
91 @flex -L -Pzconf -o$@ $<
96 @$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
99 mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
101 @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
103 nconf: $(COMMON_OBJ) $(nconf_OBJ)
105 @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
107 conf: $(COMMON_OBJ) $(conf_OBJ)
109 @$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
111 #-----------------------------------------------------------
112 # Cleaning up the mess...
115 @echo " RM 'kconfig'"
116 @rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS)
117 @rm -f rm -f zconf.tab.c zconf.hash.c lex.zconf.c lex.backup