Commit 6a19a6a4 authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

init environment once in a separate makefile (2)

parent 06f63918
......@@ -2,10 +2,9 @@
/autom4te.cache
/configure
/Makefile
/config.log
/config.status
Makefile
src/*.o
src/.dirstamp
src/main
CC= @CC@
CFLAGS= @CFLAGS@
CPPFLAGS= @CPPFLAGS@
LDFLAGS= @LDFLAGS@
LIBS= @LIBS@
SHELL= @SHELL@
BUILD_ENV= @BUILD_ENV_MAKE@
.SUFFIXES:
.PHONY: all install mostlyclean clean distclean
vpath %.c @srcdir@
prefix= @prefix@
exec_prefix= @exec_prefix@
INSTALL= @INSTALL@
src_files= \
src/foo.c \
src/main.c
obj_files= $(src_files:.c=.@OBJEXT@)
dir_files= $(addsuffix .dirstamp,$(dir $(obj_files)))
exec_files= \
src/main
DELEGATEE_DIR= src
dir_files+= $(addsuffix .dirstamp,$(dir $(exec_files)))
# Eliminate duplicates:
dir_files:= $(sort $(dir_files))
.SUFFIXES:
.NOTPARALLEL:
.PHONY: all distclean force-delegate
all: $(exec_files)
all:
$(BUILD_ENV) $(MAKE) -C $(DELEGATEE_DIR) $@
mostlyclean:
rm -f $(exec_files) $(obj_files)
%:: force-delegate
$(BUILD_ENV) $(MAKE) -C $(DELEGATEE_DIR) $@
clean: mostlyclean
rm -f $(dir_files)
Makefile:;
distclean: clean
distclean:
@$(BUILD_ENV) $(MAKE) -C $(DELEGATEE_DIR) $@
rm -f config.log config.status Makefile
install: $(exec_files)
$(INSTALL) -d @bindir@ && $(INSTALL) $^ @bindir@
src/main: $(obj_files)
$(exec_files):| $(dir_files)
$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $+ $(LIBS)
%.@OBJEXT@: %.c | $(dir_files)
$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
.PRECIOUS: $(dir_files)
%/.dirstamp:
@MKDIR_P@ $(@D) && touch $@
......@@ -10,8 +10,7 @@ ACX_BUILD_ENVIRONMENT
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT
CC= @CC@
CFLAGS= @CFLAGS@
CPPFLAGS= @CPPFLAGS@
LDFLAGS= @LDFLAGS@
LIBS= @LIBS@
.SUFFIXES:
.PHONY: all install mostlyclean clean distclean
vpath %.c @srcdir@
prefix= @prefix@
exec_prefix= @exec_prefix@
INSTALL= @INSTALL@
src_files= \
foo.c \
main.c
obj_files= $(src_files:.c=.@OBJEXT@)
exec_files= \
main
all: $(exec_files)
mostlyclean:
rm -f $(exec_files) $(obj_files)
clean: mostlyclean
distclean: clean
rm -f Makefile
install: $(exec_files)
$(INSTALL) -d @bindir@ && $(INSTALL) $^ @bindir@
main: $(obj_files)
$(exec_files):| $(dir_files)
$(CC) -o $@ $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $+ $(LIBS)
%.@OBJEXT@: %.c | $(dir_files)
$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment