Make compilation a bit faster

This commit is contained in:
Alexander S. Aganichev 2002-06-10 06:24:11 +00:00
parent 077d4b55f5
commit 0d0830ac0d
3 changed files with 25 additions and 43 deletions

View File

@ -1,6 +1,7 @@
# -*- makefile -*- # -*- makefile -*-
ifeq ($(findstring EMX, $(PATH)), EMX) ifeq ($(findstring EMX, $(PATH)), EMX)
CAT=cat
CC=gcc CC=gcc
AR=ar AR=ar
RANLIB=ar s RANLIB=ar s
@ -20,6 +21,7 @@ LIBEXT=.a
CXX=$(CC) CXX=$(CC)
else else
ifneq ($(DJGPP),) ifneq ($(DJGPP),)
CAT=type
CC=gcc CC=gcc
CXX=gpp CXX=gpp
AR=ar AR=ar
@ -31,6 +33,7 @@ OBJEXT=.o
LIBEXT=.a LIBEXT=.a
else else
ifeq ($(TERM),cygwin) ifeq ($(TERM),cygwin)
CAT=cat
CC=gcc -mno-cygwin CC=gcc -mno-cygwin
CXX=g++ -mno-cygwin CXX=g++ -mno-cygwin
AR=ar AR=ar
@ -42,6 +45,7 @@ EXEEXT=.exe
OBJEXT=.o OBJEXT=.o
LIBEXT=.a LIBEXT=.a
else else
CAT=cat
CC=gcc CC=gcc
CXX=g++ CXX=g++
AR=ar AR=ar
@ -73,4 +77,3 @@ endif
BIN=bin BIN=bin
OBJPATH=obj OBJPATH=obj
LIBPATH=lib LIBPATH=lib
DEPPATH=dep

View File

@ -1,6 +1,6 @@
# -*- makefile -*- # -*- makefile -*-
.PHONY: all clean sourcelist deps clean_sl .PHONY: all clean sourcelist
all: $(TARGET) all: $(TARGET)
@ -13,8 +13,8 @@ include $(TOP)/MSGBase.def
include $(TOP)/Config.def include $(TOP)/Config.def
FOBJPATH=$(TOP)/$(OBJPATH)/$(PLATFORM)/$(TARGET) FOBJPATH=$(TOP)/$(OBJPATH)/$(PLATFORM)/$(TARGET)
FDEPPATH=$(TOP)/$(OBJPATH)/$(PLATFORM)/$(TARGET)
FLIBPATH=$(TOP)/$(LIBPATH)/$(PLATFORM) FLIBPATH=$(TOP)/$(LIBPATH)/$(PLATFORM)
FDEPPATH=$(TOP)/$(DEPPATH)/$(PLATFORM)
.SUFFIXES: .c .cpp .all .rc .SUFFIXES: .c .cpp .all .rc
@ -25,23 +25,21 @@ bld$(PLATFORM).inc: $(TARGET).all
@grep -w $(PLATFORM) $< \ @grep -w $(PLATFORM) $< \
| sed 's;^\([[:alnum:]_]*\)[ ]*\([[:alnum:]_]*\).*;SOURCES+=\1.\2;' > $@; [ -s $@ ] || rm -f $@ | sed 's;^\([[:alnum:]_]*\)[ ]*\([[:alnum:]_]*\).*;SOURCES+=\1.\2;' > $@; [ -s $@ ] || rm -f $@
$(FDEPPATH)/$(TARGET)/%.d: %.cpp
@echo making depends for $<
@$(SHELL) -ec '$(CXX) -c -M $(CPPFLAGS) $< \
| sed '\''s;\($*\)\$(OBJEXT)[ :]*;$(subst /,\/,$(FOBJPATH))\/\1\$(OBJEXT) $(subst /,\/,$@): ;g'\'' > $@; [ -s $@ ] || rm -f $@'
$(FDEPPATH)/$(TARGET)/%.d: %.c
@echo making depends for $<
@$(SHELL) -ec '$(CC) -c -M $(CFLAGS) $< \
| sed '\''s;\($*\)\$(OBJEXT)[ :]*;$(subst /,\/,$(FOBJPATH))\/\1\$(OBJEXT) $(subst /,\/,$@): ;g'\'' > $@; [ -s $@ ] || rm -f $@'
$(FOBJPATH)/%$(OBJEXT): %.cpp $(FOBJPATH)/%$(OBJEXT): %.cpp
@echo building $(basename $<)$(OBJEXT) @echo building $(basename $<)$(OBJEXT)
@$(CXX) -c $(CPPFLAGS) -o $@ $< @$(CXX) -c -MD $(CPPFLAGS) -o $@ $<
@$(SHELL) -c "[ -s $(patsubst %.cpp,%.d,$<) ] && \
echo -n $(FOBJPATH)/>$(FDEPPATH)/$(patsubst %.cpp,%.d,$<) && \
$(CAT) $(patsubst %.cpp,%.d,$<)>>$(FDEPPATH)/$(patsubst %.cpp,%.d,$<) &&\
rm $(patsubst %.cpp,%.d,$<) || true"
$(FOBJPATH)/%$(OBJEXT): %.c $(FOBJPATH)/%$(OBJEXT): %.c
@echo building $(basename $<)$(OBJEXT) @echo building $(basename $<)$(OBJEXT)
@$(CC) -c $(CFLAGS) -o $@ $< @$(CC) -c -MD $(CFLAGS) -o $@ $<
@$(SHELL) -c "[ -s $(patsubst %.c,%.d,$<) ] && \
echo -n $(FOBJPATH)/>$(FDEPPATH)/$(patsubst %.c,%.d,$<) && \
$(CAT) $(patsubst %.c,%.d,$<)>>$(FDEPPATH)/$(patsubst %.c,%.d,$<) && \
rm $(patsubst %.c,%.d,$<) || true"
ifeq ($(PLATFORM),cyg) ifeq ($(PLATFORM),cyg)
$(FOBJPATH)/%$(OBJEXT): %.rc $(FOBJPATH)/%$(OBJEXT): %.rc
@ -56,7 +54,7 @@ $(FOBJPATH)/%.res: %.rc
endif endif
SOURCES= SOURCES=
ifeq ($(FDEPPATH)/source.lst,$(wildcard $(FDEPPATH)/source.ls?)) ifeq ($(wildcard $(TOP)/$(OBJPATH)/$(PLATFORM)/source.ls?),$(TOP)/$(OBJPATH)/$(PLATFORM)/source.lst)
include bld$(PLATFORM).inc include bld$(PLATFORM).inc
endif endif
@ -69,20 +67,13 @@ else
OBJS=$(addprefix $(FOBJPATH)/,$(patsubst %.c,%$(OBJEXT),$(patsubst %.cpp,%$(OBJEXT),$(filter %.c %.cpp %.rc,$(SOURCES))))) OBJS=$(addprefix $(FOBJPATH)/,$(patsubst %.c,%$(OBJEXT),$(patsubst %.cpp,%$(OBJEXT),$(filter %.c %.cpp %.rc,$(SOURCES)))))
endif endif
endif endif
DEPS=$(addprefix $(FDEPPATH)/$(TARGET)/,$(patsubst %.c,%.d,$(patsubst %.cpp,%.d,$(filter %.c %.cpp,$(SOURCES))))) DEPS = $(wildcard $(FDEPPATH)/*.d)
ALLOBJS = $(wildcard $(FOBJPATH)/*.o)
clean: clean:
@echo cleaning... @echo cleaning...
@-rm -f $(OBJS) $(DEPS) @-rm -f $(ALLOBJS) $(DEPS) bld$(PLATFORM).inc
clean_sl:
@echo deleting sourcelist
@-rm -f bld$(PLATFORM).inc
deps: $(DEPS)
ifeq ($(FDEPPATH)/dep,$(wildcard $(FDEPPATH)/de?))
ifneq ($(DEPS),) ifneq ($(DEPS),)
include $(DEPS) -include $(DEPS)
endif
endif endif

View File

@ -7,33 +7,21 @@ include GNUmakef.def
LIBS=gall gcfg gmb3 glibc uulib smblib LIBS=gall gcfg gmb3 glibc uulib smblib
EXECUTABLES=golded3 goldnode rddt EXECUTABLES=golded3 goldnode rddt
all: sourcelists deps all: sourcelists
@$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) all; cd ../..; done' @$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) all; cd ../..; done'
@$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) all; cd ..; done' @$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) all; cd ..; done'
clean: nodeps sourcelists clean:
@$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) clean; cd ../..; done' @$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) clean; cd ../..; done'
@$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) clean; cd ..; done' @$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) clean; cd ..; done'
@-rm -f $(DEPPATH)/$(PLATFORM)/source.lst @-rm -f $(OBJPATH)/$(PLATFORM)/source.lst
@$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) clean_sl; cd ../..; done'
@$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) clean_sl; cd ..; done'
dirs: dirs:
@mkdir -p $(BIN) $(LIBPATH)/$(PLATFORM) @mkdir -p $(BIN) $(LIBPATH)/$(PLATFORM)
@mkdir -p $(foreach dir,$(LIBS),$(OBJPATH)/$(PLATFORM)/$(dir)) @mkdir -p $(foreach dir,$(LIBS),$(OBJPATH)/$(PLATFORM)/$(dir))
@mkdir -p $(foreach dir,$(EXECUTABLES),$(OBJPATH)/$(PLATFORM)/$(dir)) @mkdir -p $(foreach dir,$(EXECUTABLES),$(OBJPATH)/$(PLATFORM)/$(dir))
@mkdir -p $(foreach dir,$(LIBS),$(DEPPATH)/$(PLATFORM)/$(dir))
@mkdir -p $(foreach dir,$(EXECUTABLES),$(DEPPATH)/$(PLATFORM)/$(dir))
deps:
@$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) deps; cd ../..; done'
@$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) deps; cd ..; done'
@echo -n >$(DEPPATH)/$(PLATFORM)/dep
nodeps:
@-rm -f $(DEPPATH)/$(PLATFORM)/dep
sourcelists: dirs sourcelists: dirs
@$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) sourcelist; cd ../..; done' @$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) sourcelist; cd ../..; done'
@$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) sourcelist; cd ..; done' @$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) sourcelist; cd ..; done'
@echo -n >$(DEPPATH)/$(PLATFORM)/source.lst @echo -n >$(OBJPATH)/$(PLATFORM)/source.lst