2012-01-14 17:22:06 +00:00
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Hmmm! Cheesy build!
|
|
|
|
# Or: where I can unveil my make-fu... :-]
|
|
|
|
|
2017-01-13 00:53:28 +00:00
|
|
|
__silent = $(if $(V),,@printf ' %-7s %s\n' '$1' '$(if $2,$2,$(strip $<))' && )
|
|
|
|
__silent_rm = $(call __silent,RM,$1)rm -f $1
|
|
|
|
|
|
|
|
PROGS = conf mconf nconf
|
|
|
|
|
|
|
|
all: $(PROGS)
|
2012-01-14 17:22:06 +00:00
|
|
|
@true # Just be silent, you fscking son of a fscking beach...
|
|
|
|
|
|
|
|
# Build flags
|
2017-01-13 01:35:35 +00:00
|
|
|
CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE="\"crosstool-NG $(VERSION)\"" \
|
|
|
|
-DGPERF_LEN_TYPE="$(gperf_len_type)"
|
2015-11-06 00:20:16 +00:00
|
|
|
LDFLAGS = $(INTL_LIBS)
|
2012-01-14 17:22:06 +00:00
|
|
|
|
2017-06-07 03:06:04 +00:00
|
|
|
ifneq (@DPKG_BUILDFLAGS@,)
|
|
|
|
CFLAGS += $(shell @DPKG_BUILDFLAGS@ --get CPPFLAGS) \
|
|
|
|
$(shell @DPKG_BUILDFLAGS@ --get CFLAGS)
|
|
|
|
LDFLAGS += $(shell @DPKG_BUILDFLAGS@ --get LDFLAGS)
|
|
|
|
endif
|
|
|
|
|
2012-01-14 17:22:06 +00:00
|
|
|
# Compiler flags to use gettext
|
|
|
|
ifeq ($(gettext),)
|
2015-09-01 23:11:30 +00:00
|
|
|
INTL_CFLAGS = -Wno-format-security -DKBUILD_NO_NLS
|
2012-01-14 17:22:06 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
# Compiler and linker flags to use ncurses
|
|
|
|
NCURSES_CFLAGS = -DCURSES_LOC="\"$(curses_hdr)\""
|
|
|
|
NCURSES_LDFLAGS = $(LIBS)
|
|
|
|
|
|
|
|
# Common source files
|
|
|
|
COMMON_SRC = zconf.tab.c
|
|
|
|
COMMON_OBJ = $(patsubst %.c,%.o,$(COMMON_SRC))
|
|
|
|
COMMON_DEP = $(patsubst %.o,%.dep,$(COMMON_OBJ))
|
2012-01-15 00:04:26 +00:00
|
|
|
$(COMMON_OBJ) $(COMMON_DEP): CFLAGS += $(INTL_CFLAGS) -I.
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
# lxdialog source files
|
2014-06-25 21:33:01 +00:00
|
|
|
LX_SRC = $(sort $(wildcard lxdialog/*.c))
|
2012-01-14 17:22:06 +00:00
|
|
|
LX_OBJ = $(patsubst %.c,%.o,$(LX_SRC))
|
|
|
|
LX_DEP = $(patsubst %.o,%.dep,$(LX_OBJ))
|
|
|
|
$(LX_OBJ) $(LX_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
|
|
|
|
|
|
|
|
# What's needed to build 'conf'
|
|
|
|
conf_SRC = conf.c
|
|
|
|
conf_OBJ = $(patsubst %.c,%.o,$(conf_SRC))
|
|
|
|
conf_DEP = $(patsubst %.o,%.dep,$(conf_OBJ))
|
|
|
|
$(conf_OBJ) $(conf_DEP): CFLAGS += $(INTL_CFLAGS)
|
|
|
|
|
|
|
|
# What's needed to build 'mconf'
|
|
|
|
mconf_SRC = mconf.c
|
|
|
|
mconf_OBJ = $(patsubst %.c,%.o,$(mconf_SRC))
|
|
|
|
mconf_DEP = $(patsubst %.c,%.dep,$(mconf_SRC))
|
|
|
|
$(mconf_OBJ) $(mconf_DEP): CFLAGS += $(NCURSES_CFLAGS) $(INTL_CFLAGS)
|
|
|
|
mconf: LDFLAGS += $(NCURSES_LDFLAGS)
|
|
|
|
|
|
|
|
# What's needed to build 'nconf'
|
|
|
|
nconf_SRC = nconf.c nconf.gui.c
|
|
|
|
nconf_OBJ = $(patsubst %.c,%.o,$(nconf_SRC))
|
|
|
|
nconf_DEP = $(patsubst %.c,%.dep,$(nconf_SRC))
|
2012-07-31 21:04:49 +00:00
|
|
|
$(nconf_OBJ) $(nconf_DEP): CFLAGS += $(INTL_CFLAGS) -I/usr/include/ncurses
|
2015-11-15 06:55:40 +00:00
|
|
|
nconf: LDFLAGS += -lmenu -lpanel $(LIBS)
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
# These are generated files:
|
|
|
|
ALL_OBJS = $(sort $(COMMON_OBJ) $(LX_OBJ) $(conf_OBJ) $(mconf_OBJ) $(nconf_OBJ))
|
|
|
|
ALL_DEPS = $(sort $(COMMON_DEP) $(LX_DEP) $(conf_DEP) $(mconf_DEP) $(nconf_DEP))
|
|
|
|
|
|
|
|
# Cheesy auto-dependencies
|
|
|
|
DEPS = $(COMMON_DEP)
|
|
|
|
DEPS += $(conf_DEP)
|
|
|
|
DEPS += $(mconf_DEP) $(LX_DEP)
|
|
|
|
DEPS += $(nconf_DEP)
|
|
|
|
-include $(DEPS)
|
|
|
|
|
|
|
|
# Build the dependency for C files
|
|
|
|
%.dep: %.c
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,DEP,$@)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -MM $< |$(sed) -r -e 's|([^:]+.o)( *:+)|$(<:.c=.o) $@\2|;' >$@
|
2012-01-14 17:22:06 +00:00
|
|
|
|
2012-01-15 00:04:26 +00:00
|
|
|
# Generate the grammar parser
|
2015-09-01 23:11:30 +00:00
|
|
|
zconf.tab.o: zconf.tab.c zconf.hash.c zconf.lex.c
|
|
|
|
zconf.tab.dep: zconf.tab.c zconf.hash.c zconf.lex.c
|
2012-01-15 00:04:26 +00:00
|
|
|
|
|
|
|
.PRECIOUS: zconf.tab.c
|
|
|
|
zconf.tab.c: zconf.y
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,BISON)bison -l -b zconf -p zconf $<
|
2012-01-15 00:04:26 +00:00
|
|
|
|
|
|
|
zconf.hash.c: zconf.gperf
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,GPERF)$(gperf) -C < $< > $@
|
2012-01-15 00:04:26 +00:00
|
|
|
|
2015-09-01 23:11:30 +00:00
|
|
|
zconf.lex.c: zconf.l
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,LEX)flex -L -Pzconf -o$@ $<
|
2012-01-15 00:04:26 +00:00
|
|
|
|
2012-01-14 17:22:06 +00:00
|
|
|
# Build C files
|
|
|
|
%.o: %.c
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,CC)$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
# Actual link
|
|
|
|
mconf: $(COMMON_OBJ) $(LX_OBJ) $(mconf_OBJ)
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
nconf: $(COMMON_OBJ) $(nconf_OBJ)
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
conf: $(COMMON_OBJ) $(conf_OBJ)
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,LD,$@)$(CC) -o $@ $^ $(LDFLAGS) $(EXTRA_LDFLAGS)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Installation
|
|
|
|
install: $(patsubst %,install-%,$(PROGS)) install-kconfig.mk
|
|
|
|
|
2017-06-07 03:06:04 +00:00
|
|
|
$(patsubst %,install-%,$(PROGS)): install-%: %
|
|
|
|
$(call __silent,INSTALL,$<)install -m 0755 $< $(DESTDIR)/$<
|
|
|
|
|
|
|
|
install-kconfig.mk: kconfig.mk
|
|
|
|
$(call __silent,INSTALL,$<)install -m 0644 $< $(DESTDIR)/$<
|
2012-01-14 17:22:06 +00:00
|
|
|
|
|
|
|
#-----------------------------------------------------------
|
|
|
|
# Cleaning up the mess...
|
|
|
|
|
|
|
|
clean:
|
2017-01-13 00:53:28 +00:00
|
|
|
$(call __silent,RM,objs)rm -f $(ALL_OBJS) $(ALL_DEPS)
|
|
|
|
$(call __silent_rm,$(PROGS))
|
|
|
|
$(call __silent_rm,zconf.tab.c zconf.hash.c zconf.lex.c lex.backup)
|