improve clean targets
[buildroot.git] / package / m4 / m4.mk
blob4ece6144639f03c1e2ad150aae8cdc1242f645bc
1 #############################################################
3 # m4
5 #############################################################
6 M4_VERSION:=1.4.10
7 M4_SOURCE:=m4-$(M4_VERSION).tar.bz2
8 M4_CAT:=$(BZCAT)
9 M4_SITE:=$(BR2_GNU_MIRROR)/m4
10 M4_DIR:=$(BUILD_DIR)/m4-$(M4_VERSION)
11 M4_HOST_DIR:=$(TOOL_BUILD_DIR)/m4-$(M4_VERSION)
12 M4_BINARY:=m4
13 M4_TARGET_BINARY:=usr/bin/m4
15 ifeq ($(UCLIBC_HAS_REGEX),y)
16 gl_cv_func_re_compile_pattern_working=gl_cv_func_re_compile_pattern_working=yes
17 endif
18 ifneq ($(UCLIBC_HAS_WCHAR),y)
19 gt_cv_c_wchar_t=gt_cv_c_wchar_t=no
20 gl_cv_absolute_wchar_h=gl_cv_absolute_wchar_h=__fpending.h
21 endif
23 $(DL_DIR)/$(M4_SOURCE):
24 $(WGET) -P $(DL_DIR) $(M4_SITE)/$(M4_SOURCE)
26 $(M4_DIR)/.unpacked: $(DL_DIR)/$(M4_SOURCE)
27 $(M4_CAT) $(DL_DIR)/$(M4_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
28 toolchain/patch-kernel.sh $(M4_DIR) package/m4 m4\*.patch
29 $(CONFIG_UPDATE) $(@D)
30 touch $@
32 $(M4_DIR)/.configured: $(M4_DIR)/.unpacked
33 (cd $(M4_DIR); rm -rf config.cache; \
34 gl_cv_func_gettimeofday_clobber=no \
35 $(gl_cv_func_re_compile_pattern_working) \
36 $(gt_cv_c_wchar_t) \
37 $(gl_cv_absolute_wchar_h) \
38 $(AUTO_CONFIGURE_TARGET) \
39 --prefix=/usr \
40 --disable-assert \
41 $(DISABLE_LARGEFILE) \
43 touch $@
45 $(M4_DIR)/src/$(M4_BINARY): $(M4_DIR)/.configured
46 $(MAKE) -C $(M4_DIR)
48 $(TARGET_DIR)/$(M4_TARGET_BINARY): $(M4_DIR)/src/$(M4_BINARY)
49 $(MAKE) -C $(M4_DIR) DESTDIR=$(TARGET_DIR) install
50 ifneq ($(BR2_HAVE_INFOPAGES),y)
51 rm -rf $(TARGET_DIR)/usr/share/info
52 endif
53 ifneq ($(BR2_HAVE_MANPAGES),y)
54 rm -rf $(TARGET_DIR)/usr/share/man
55 endif
56 rm -rf $(TARGET_DIR)/share/locale
57 rm -rf $(TARGET_DIR)/usr/share/doc
58 $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/$(M4_TARGET_BINARY)
60 m4: uclibc $(TARGET_DIR)/$(M4_TARGET_BINARY)
62 m4-source: $(DL_DIR)/$(M4_SOURCE)
64 m4-clean:
65 -$(MAKE) -C $(M4_DIR) clean
66 $(MAKE) DESTDIR=$(TARGET_DIR) -C $(M4_DIR) uninstall
68 m4-dirclean:
69 rm -rf $(M4_DIR)
71 #############################################################
73 # m4 for the host
75 #############################################################
77 $(M4_HOST_DIR)/.unpacked: $(DL_DIR)/$(M4_SOURCE)
78 $(M4_CAT) $(DL_DIR)/$(M4_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
79 toolchain/patch-kernel.sh $(M4_HOST_DIR) package/m4 m4\*.patch
80 $(CONFIG_UPDATE) $(@D)
81 touch $@
83 $(M4_HOST_DIR)/.configured: $(M4_HOST_DIR)/.unpacked
84 (cd $(M4_HOST_DIR); rm -rf config.cache; \
85 $(HOST_CONFIGURE_OPTS) \
86 CFLAGS="$(HOST_CFLAGS)" \
87 LDFLAGS="$(HOST_LDFLAGS)" \
88 gl_cv_func_gettimeofday_clobber=no \
89 $(gl_cv_func_re_compile_pattern_working) \
90 ./configure \
91 --prefix=$(STAGING_DIR)/usr \
92 $(DISABLE_LARGEFILE) \
94 touch $@
96 $(M4_HOST_DIR)/src/$(M4_BINARY): $(M4_HOST_DIR)/.configured
97 $(MAKE) -C $(M4_HOST_DIR)
99 $(STAGING_DIR)/$(M4_TARGET_BINARY): $(M4_HOST_DIR)/src/$(M4_BINARY)
100 $(MAKE) -C $(M4_HOST_DIR) install
102 host-m4: uclibc $(STAGING_DIR)/$(M4_TARGET_BINARY)
104 host-m4-clean:
105 $(MAKE) -C $(M4_HOST_DIR) uninstall
106 -$(MAKE) -C $(M4_HOST_DIR) clean
108 host-m4-dirclean:
109 rm -rf $(M4_HOST_DIR)
111 #############################################################
113 # Toplevel Makefile options
115 #############################################################
116 ifeq ($(BR2_PACKAGE_M4),y)
117 TARGETS+=m4
118 endif