aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaimo Niskanen <[email protected]>2012-01-11 18:33:19 +0100
committerRaimo Niskanen <[email protected]>2012-01-23 16:58:41 +0100
commitec052cc7adda144d6233f38e665850bb20ff0e0e (patch)
treedf019abe9b5c0b4714775de24cfc0fb62d363540
parent6fafcdcbe96d1f67d57715011acd1bb0ca858949 (diff)
downloadotp-ec052cc7adda144d6233f38e665850bb20ff0e0e.tar.gz
otp-ec052cc7adda144d6233f38e665850bb20ff0e0e.tar.bz2
otp-ec052cc7adda144d6233f38e665850bb20ff0e0e.zip
erts: Fix dependencies between targets generate and depend
* Make generate and depend.mk automatically. * Do not make depend.mk for targets clean and generate. * Remove old replaced CREATE_DIRS cruft. * Fiercer remove by target clean. * Move depend.mk to Target/Type/Flavor directory.
-rw-r--r--erts/emulator/Makefile.in60
-rw-r--r--erts/emulator/pcre/pcre.mk8
-rw-r--r--erts/etc/common/Makefile.in1
-rw-r--r--erts/lib_src/Makefile.in9
4 files changed, 38 insertions, 40 deletions
diff --git a/erts/emulator/Makefile.in b/erts/emulator/Makefile.in
index c4b595822c..d7f2853c96 100644
--- a/erts/emulator/Makefile.in
+++ b/erts/emulator/Makefile.in
@@ -317,7 +317,8 @@ LIBSCTP = @LIBSCTP@
ORG_THR_LIBS=@EMU_THR_LIBS@
THR_LIB_NAME=@EMU_THR_LIB_NAME@
-ERTS_LIB = $(ERL_TOP)/erts/lib_src/obj/$(TARGET)/$(TYPE)/MADE
+ERTS_LIB_DIR = $(ERL_TOP)/erts/lib_src
+ERTS_LIB = $(ERTS_LIB_DIR)/obj/$(TARGET)/$(TYPE)/MADE
DEPLIBS += $(ERTS_LIB)
THR_LIBS=$(subst -l$(THR_LIB_NAME),-l$(THR_LIB_NAME)$(TYPEMARKER), \
@@ -402,23 +403,17 @@ include zlib/zlib.mk
include pcre/pcre.mk
$(ERTS_LIB):
- cd $(ERL_TOP)/erts/lib_src && $(MAKE) $(TYPE)
+ cd $(ERTS_LIB_DIR) && $(MAKE) $(TYPE)
clean:
-ifeq ($(TARGET),win32)
- $(RM) -f $(TARGET)/beams.rc
-endif
- $(RM) -f $(TARGET)/*.c $(TARGET)/*.h $(TARGET)/depend.mk
- $(RM) -f $(TARGET)/*/*/*.c $(TARGET)/*/*/*.h $(TARGET)/*/*/*.S
- $(RM) -f $(ERL_TOP)/erts/emulator/obj/$(TARGET)/*/*/*.o
- $(RM) -f $(BINDIR)/beam $(BINDIR)/beam.*
- $(RM) -rf $(BINDIR)/child_setup $(BINDIR)/child_setup.*
- $(RM) -f $(BINDIR)/hipe_mkliterals $(BINDIR)/hipe_mkliterals.*
-ifndef Z_LIB
- $(RM) -rf $(ZLIB_OBJDIR)
-endif
- rm -f $(OBJS) $(OBJDIR)/libepcre.a
- cd $(ERL_TOP)/erts/lib_src && $(MAKE) clean
+ $(RM) -f $(GENERATE)
+ $(RM) -rf $(TARGET)/*.c $(TARGET)/*.h $(TARGET)/*-GENERATED
+ $(RM) -rf $(TARGET)/*/*
+ $(RM) -rf obj/$(TARGET)
+ $(RM) -rf pcre/obj/$(TARGET) $(PCRE_GENINC)
+ $(RM) -rf zlib/obj/$(TARGET)
+ $(RM) -rf bin/$(TARGET)
+ cd $(ERTS_LIB_DIR) && $(MAKE) clean
.PHONY: all clean
@@ -955,13 +950,6 @@ $(BINDIR)/$(EMULATOR_EXECUTABLE): $(INIT_OBJS) $(OBJS) $(DEPLIBS)
endif
-#
-# Create directories
-#
-
-$(CREATE_DIRS):
- $(MKDIR) -p $@
-
# ----------------------------------------------------------------------
# Dependencies
#
@@ -1038,21 +1026,29 @@ DEP_FLAGS=-MM $(MG_FLAG) $(CFLAGS) $(INCLUDES) -Idrivers/common -Idrivers/$(ERLA
SYS_SRC=$(ALL_SYS_SRC)
endif
-depend:
+depend: $(TTF_DIR)/depend.mk
+$(TTF_DIR)/depend.mk: $(TTF_DIR)/GENERATED
$(DEP_CC) $(DEP_FLAGS) $(BEAM_SRC) \
- | $(SED_DEPEND) > $(TARGET)/depend.mk
+ | $(SED_DEPEND) > $(TTF_DIR)/depend.mk
$(DEP_CC) $(DEP_FLAGS) -DLIBSCTP=$(LIBSCTP) $(DRV_COMMON_SRC) \
- | $(SED_DEPEND) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk
$(DEP_CC) $(DEP_FLAGS) -I../etc/$(ERLANG_OSTYPE) $(DRV_OSTYPE_SRC) \
- | $(SED_DEPEND) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk
$(DEP_CC) $(DEP_FLAGS) $(SYS_SRC) \
- | $(SED_DEPEND) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk
$(DEP_CC) $(DEP_FLAGS) $(TARGET_SRC) \
- | $(SED_DEPEND) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk
$(DEP_CC) $(DEP_FLAGS) $(ZLIB_SRC) \
- | $(SED_DEPEND_ZLIB) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND_ZLIB) >> $(TTF_DIR)/depend.mk
ifdef HIPE_ENABLED
$(DEP_CC) $(DEP_FLAGS) $(HIPE_SRC) \
- | $(SED_DEPEND) >> $(TARGET)/depend.mk
+ | $(SED_DEPEND) >> $(TTF_DIR)/depend.mk
+endif
+ cd $(ERTS_LIB_DIR) && $(MAKE) depend
+endif
+
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(MAKECMDGOALS),generate)
+-include $(TTF_DIR)/depend.mk
+endif
endif
--include $(TARGET)/depend.mk
diff --git a/erts/emulator/pcre/pcre.mk b/erts/emulator/pcre/pcre.mk
index 1aad98ff04..352137b341 100644
--- a/erts/emulator/pcre/pcre.mk
+++ b/erts/emulator/pcre/pcre.mk
@@ -41,7 +41,7 @@ pcre_xclass.o
PCRE_OBJS = $(PCRE_O:%=$(PCRE_OBJDIR)/%)
-GENINC = pcre/pcre_exec_loop_break_cases.inc
+PCRE_GENINC = $(ERL_TOP)/erts/emulator/pcre/pcre_exec_loop_break_cases.inc
PCRE_OBJDIR = $(ERL_TOP)/erts/emulator/pcre/obj/$(TARGET)/$(TYPE)
@@ -59,12 +59,12 @@ endif
$(PCRE_OBJDIR)/%.o: pcre/%.c
$(CC) -c $(PCRE_CFLAGS) -o $@ $<
-$(GENINC): pcre/pcre_exec.c
+$(PCRE_GENINC): pcre/pcre_exec.c
for x in `grep -n COST_CHK pcre/pcre_exec.c | grep -v 'COST_CHK(N)' | awk -F: '{print $$1}'`; \
do \
N=`expr $$x + 100`; \
echo "case $$N: goto L_LOOP_COUNT_$${x};"; \
- done > $(GENINC)
+ done > $(PCRE_GENINC)
# Dependencies.
@@ -77,7 +77,7 @@ $(PCRE_OBJDIR)/pcre_config.o: pcre/pcre_config.c pcre/pcre_internal.h \
$(PCRE_OBJDIR)/pcre_dfa_exec.o: pcre/pcre_dfa_exec.c pcre/pcre_internal.h \
pcre/local_config.h pcre/pcre.h pcre/ucp.h
$(PCRE_OBJDIR)/pcre_exec.o: pcre/pcre_exec.c pcre/pcre_internal.h \
- pcre/local_config.h pcre/pcre.h pcre/ucp.h $(GENINC)
+ pcre/local_config.h pcre/pcre.h pcre/ucp.h $(PCRE_GENINC)
$(PCRE_OBJDIR)/pcre_fullinfo.o: pcre/pcre_fullinfo.c pcre/pcre_internal.h \
pcre/local_config.h pcre/pcre.h pcre/ucp.h
$(PCRE_OBJDIR)/pcre_get.o: pcre/pcre_get.c pcre/pcre_internal.h \
diff --git a/erts/etc/common/Makefile.in b/erts/etc/common/Makefile.in
index edd5c591be..18f25b017b 100644
--- a/erts/etc/common/Makefile.in
+++ b/erts/etc/common/Makefile.in
@@ -286,6 +286,7 @@ endif
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/vxcall.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/erl.o
rm -f $(ERL_TOP)/erts/obj*/$(TARGET)/werl.o
+ rm -f $(TEXTFILES)
rm -f *~ core
#
diff --git a/erts/lib_src/Makefile.in b/erts/lib_src/Makefile.in
index e427ecf312..ea80e74100 100644
--- a/erts/lib_src/Makefile.in
+++ b/erts/lib_src/Makefile.in
@@ -514,8 +514,6 @@ clean:
$(RM) -rf ../lib/internal/$(TARGET)/*
$(RM) -rf ../lib/$(TARGET)/*
$(RM) -rf obj/$(TARGET)/*
- $(RM) -f $(TARGET)/depend.mk
- $(RM) -f $(OBJ_DIR)/erts_lib
#
# Make dependencies
@@ -557,10 +555,11 @@ SED_MDd_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MDd_O);$(SED_REPL_TT_DIR);$(SED_REPL
SED_MT_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MT_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
SED_MTd_DEPEND=sed '$(SED_PREFIX)$(SED_REPL_MTd_O);$(SED_REPL_TT_DIR);$(SED_REPL_TARGET)'
-DEPEND_MK=$(TARGET)/depend.mk
+DEPEND_MK=$(OBJ_DIR)/depend.mk
.PHONY: depend
-depend:
+depend: $(DEPEND_MK)
+$(DEPEND_MK):
@echo "Generating dependency file $(DEPEND_MK)..."
@echo "# Generated dependency rules" > $(DEPEND_MK);
@echo "# " >> $(DEPEND_MK);
@@ -633,6 +632,8 @@ endif
endif
@echo "# EOF" >> $(DEPEND_MK);
+ifneq ($(MAKECMDGOALS),clean)
-include $(DEPEND_MK)
+endif
# eof