kconfig/Makefile
author danielrubiob@gmail.com
Sun Feb 09 22:24:56 2014 +0100 (2014-02-09)
changeset 3284 f9dec799e51e
parent 3019 6f23aba03281
child 3325 069f43a215cc
permissions -rw-r--r--
complibs/mpc: bump version

Signed-off-by: Daniel Rubio Bonilla <danielrubiob@gmail.com>
Message-Id: <d78f3a4ba2df1e076851.1391984022@uemo>
Patchwork-Id: 318636
yann@926
     1
#-----------------------------------------------------------
yann@940
     2
# Hmmm! Cheesy build!
yann@940
     3
# Or: where I can unveil my make-fu... :-]
yann@1
     4
yann@2835
     5
all: conf mconf nconf
yann@2835
     6
	@true   # Just be silent, you fscking son of a fscking beach...
yann@959
     7
yann@959
     8
# Build flags
yann@2835
     9
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\""
yann@959
    10
LDFLAGS =
yann@182
    11
yann@943
    12
# Compiler flags to use gettext
yann@2835
    13
ifeq ($(gettext),)
yann@2835
    14
INTL_CFLAGS = -DKBUILD_NO_NLS
yann@2835
    15
endif
yann@943
    16
yann@940
    17
# Compiler and linker flags to use ncurses
yann@2835
    18
NCURSES_CFLAGS = -DCURSES_LOC="\"$(curses_hdr)\""
yann@2835
    19
NCURSES_LDFLAGS = $(LIBS)
yann@182
    20
yann@959
    21
# Common source files
yann@2835
    22
COMMON_SRC = zconf.tab.c
yann@959
    23
COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
yann@959
    24
COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
yann@2836
    25
$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS) -I.
yann@959
    26
yann@959
    27
# lxdialog source files
yann@2835
    28
LX_SRC = $(wildcard lxdialog/*.c)
yann@959
    29
LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
yann@959
    30
LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
yann@959
    31
$(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
yann@816
    32
yann@940
    33
# What's needed to build 'conf'
yann@2835
    34
conf_SRC = conf.c
yann@959
    35
conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
yann@959
    36
conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
yann@959
    37
$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
yann@816
    38
yann@940
    39
# What's needed to build 'mconf'
yann@2835
    40
mconf_SRC = mconf.c
yann@940
    41
mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
yann@959
    42
mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
yann@959
    43
$(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
yann@2835
    44
mconf: LDFLAGS += $(NCURSES_LDFLAGS)
yann@2454
    45
yann@2454
    46
# What's needed to build 'nconf'
yann@2835
    47
nconf_SRC = nconf.c nconf.gui.c
yann@2454
    48
nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
yann@2454
    49
nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
yann@3019
    50
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
yann@2835
    51
nconf: LDFLAGS += -lmenu -lpanel -lncurses
yann@2454
    52
yann@2454
    53
# Under Cygwin, we need to auto-import some libs (which ones, exactly?)
yann@2454
    54
# for mconf and nconf to lin properly.
yann@1087
    55
ifeq ($(shell uname -o 2>/dev/null || echo unknown),Cygwin)
yann@2835
    56
mconf: LDFLAGS += -Wl,--enable-auto-import
yann@2835
    57
nconf: LDFLAGS += -Wl,--enable-auto-import
yann@1087
    58
endif
yann@959
    59
yann@959
    60
# These are generated files:
yann@2454
    61
ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
yann@2454
    62
ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
yann@1
    63
yann@940
    64
# Cheesy auto-dependencies
yann@959
    65
DEPS = $(COMMON_DEP)
yann@959
    66
DEPS += $(conf_DEP)
yann@959
    67
DEPS += $(mconf_DEP) $(LX_DEP)
yann@2454
    68
DEPS += $(nconf_DEP)
yann@945
    69
-include $(DEPS)
yann@940
    70
yann@959
    71
# Build the dependency for C files
yann@2835
    72
%.dep: %.c
yann@2835
    73
	@echo "  DEP    '$@'"
yann@2835
    74
	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
yann@940
    75
yann@2836
    76
# Generate the grammar parser
yann@2836
    77
zconf.tab.o: zconf.tab.c zconf.hash.c lex.zconf.c
yann@2836
    78
zconf.tab.dep: zconf.tab.c zconf.hash.c lex.zconf.c
yann@2836
    79
yann@2836
    80
.PRECIOUS: zconf.tab.c
yann@2836
    81
zconf.tab.c: zconf.y
yann@2836
    82
	@echo "  BISON  '$@'"
yann@2836
    83
	@bison -l -b zconf -p zconf $<
yann@2836
    84
yann@2836
    85
zconf.hash.c: zconf.gperf
yann@2836
    86
	@echo "  GPERF  '$@'"
mingw@3231
    87
	@$(gperf) < $< > $@
yann@2836
    88
yann@2836
    89
lex.zconf.c: zconf.l
yann@2836
    90
	@echo "  LEX    '$@'"
patrickdepinguin+buildroot@2998
    91
	@flex -L -Pzconf -o$@ $<
yann@2836
    92
yann@959
    93
# Build C files
yann@2835
    94
%.o: %.c
yann@2835
    95
	@echo "  CC     '$@'"
yann@2835
    96
	@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
yann@940
    97
yann@959
    98
# Actual link
yann@2835
    99
mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
yann@2835
   100
	@echo "  LD     '$@'"
yann@2835
   101
	@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
yann@940
   102
yann@2835
   103
nconf: $(COMMON_OBJ) $(nconf_OBJ)
yann@2835
   104
	@echo "  LD     '$@'"
yann@2835
   105
	@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
yann@2454
   106
yann@2835
   107
conf: $(COMMON_OBJ) $(conf_OBJ)
yann@2835
   108
	@echo "  LD     '$@'"
yann@2835
   109
	@$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
yann@1
   110
yann@926
   111
#-----------------------------------------------------------
yann@926
   112
# Cleaning up the mess...
yann@926
   113
yann@2835
   114
clean:
yann@2835
   115
	@echo "  RM     'kconfig'"
yann@2835
   116
	@rm -f conf mconf nconf $(ALL_OBJS) $(ALL_DEPS)
yann@2836
   117
	@rm -f rm -f zconf.tab.c zconf.hash.c lex.zconf.c lex.backup