Fixed makefiles

This commit is contained in:
Alexander S. Aganichev 2001-05-27 19:28:13 +00:00
parent 6a5125b7e5
commit c720ab6783
2 changed files with 75 additions and 12 deletions

View File

@ -1,6 +1,6 @@
# -*- makefile -*- # -*- makefile -*-
.PHONY: all clean .PHONY: all clean sourcelist deps clean_sl
all: $(TARGET) all: $(TARGET)
@ -18,12 +18,13 @@ FDEPPATH=$(TOP)/$(DEPPATH)/$(PLATFORM)
.SUFFIXES: .c .cpp .all .rc .SUFFIXES: .c .cpp .all .rc
sourcelist: bld$(PLATFORM).inc
bld$(PLATFORM).inc: $(TARGET).all bld$(PLATFORM).inc: $(TARGET).all
@echo making sourcelist @echo making sourcelist
@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 $@
ifeq ($(FDEPPATH)/dep,$(wildcard $(FDEPPATH)/de?))
$(FDEPPATH)/$(TARGET)/%.d: %.cpp $(FDEPPATH)/$(TARGET)/%.d: %.cpp
@echo making depends for $< @echo making depends for $<
@$(SHELL) -ec '$(CXX) -c -M $(CPPFLAGS) $< \ @$(SHELL) -ec '$(CXX) -c -M $(CPPFLAGS) $< \
@ -33,7 +34,6 @@ $(FDEPPATH)/$(TARGET)/%.d: %.c
@echo making depends for $< @echo making depends for $<
@$(SHELL) -ec '$(CC) -c -M $(CFLAGS) $< \ @$(SHELL) -ec '$(CC) -c -M $(CFLAGS) $< \
| sed '\''s;\($*\)\$(OBJEXT)[ :]*;$(subst /,\/,$(FOBJPATH))\/\1\$(OBJEXT) $(subst /,\/,$@): ;g'\'' > $@; [ -s $@ ] || rm -f $@' | sed '\''s;\($*\)\$(OBJEXT)[ :]*;$(subst /,\/,$(FOBJPATH))\/\1\$(OBJEXT) $(subst /,\/,$@): ;g'\'' > $@; [ -s $@ ] || rm -f $@'
endif
$(FOBJPATH)/%$(OBJEXT): %.cpp $(FOBJPATH)/%$(OBJEXT): %.cpp
@echo building $(basename $<)$(OBJEXT) @echo building $(basename $<)$(OBJEXT)
@ -55,6 +55,54 @@ $(FOBJPATH)/%.res: %.rc
@rc $(subst -I,-i ,$(INCS)) -x1 -r $< @rc $(subst -I,-i ,$(INCS)) -x1 -r $<
endif endif
SOURCES=
ifeq ($(FDEPPATH)/source.lst,$(wildcard $(FDEPPATH)/source.ls?))
include bld$(PLATFORM).inc
endif
ifeq ($(PLATFORM),cyg)
OBJS=$(addprefix $(FOBJPATH)/,$(patsubst %.rc,$(OBJEXT),$(patsubst %.c,$(OBJEXT),$(patsubst %.cpp,%$(OBJEXT),$(filter %.c %.cpp %.rc,$(SOURCES))))))
else
ifeq ($(PLATFORM),emx)
OBJS=$(addprefix $(FOBJPATH)/,$(patsubst %.rc,%.res,$(patsubst %.c,%$(OBJEXT),$(patsubst %.cpp,%$(OBJEXT),$(filter %.c %.cpp %.rc,$(SOURCES))))))
else
OBJS=$(addprefix $(FOBJPATH)/,$(patsubst %.c,%$(OBJEXT),$(patsubst %.cpp,%$(OBJEXT),$(filter %.c %.cpp %.rc,$(SOURCES)))))
endif
endif
DEPS=$(addprefix $(FDEPPATH)/$(TARGET)/,$(patsubst %.c,%.d,$(patsubst %.cpp,%.d,$(filter %.c %.cpp,$(SOURCES)))))
clean:
@echo cleaning...
@-rm -f $(OBJS) $(DEPS)
clean_sl:
@echo deleting sourcelist
@-rm -f bld$(PLATFORM).inc
deps: $(DEPS)
ifeq ($(FDEPPATH)/dep,$(wildcard $(FDEPPATH)/de?))
ifneq ($(DEPS),)
include $(DEPS)
endif
endif
$(FOBJPATH)/%$(OBJEXT): %.c
@echo building $(basename $<)$(OBJEXT)
@$(CC) -c $(CFLAGS) -o $@ $<
ifeq ($(PLATFORM),cyg)
$(FOBJPATH)/%$(OBJEXT): %.rc
@echo creating resources
@$(WINDRES) -o $@ $<
endif
ifeq ($(PLATFORM),emx)
$(FOBJPATH)/%.res: %.rc
@echo creating resources
@rc $(subst -I,-i ,$(INCS)) -x1 -r $<
endif
SOURCES= SOURCES=
-include bld$(PLATFORM).inc -include bld$(PLATFORM).inc
ifeq ($(PLATFORM),cyg) ifeq ($(PLATFORM),cyg)

View File

@ -2,19 +2,21 @@
include GNUmakef.def include GNUmakef.def
.PHONY: all clean distclean dirs sourcelists deps
LIBS=gall gcfg gmb3 glibc uulib LIBS=gall gcfg gmb3 glibc uulib
EXECUTABLES=golded3 goldnode rddt EXECUTABLES=golded3 goldnode rddt
all: all: sourcelists deps
@$(MAKE) dirs @$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) all; cd ../..; done'
@echo -n >$(DEPPATH)/$(PLATFORM)/dep @$(SHELL) -ec 'for i in $(EXECUTABLES); do cd $$i; $(MAKE) all; cd ..; done'
@for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i && $(MAKE) && cd ../..; done
@for i in $(EXECUTABLES); do cd $$i && $(MAKE) && cd ..; done
clean: clean: nodeps sourcelists
@rm -f $(DEPPATH)/$(PLATFORM)/dep @$(SHELL) -ec 'for i in $(foreach dir,$(LIBS),goldlib/$(dir)); do cd $$i; $(MAKE) clean; cd ../..; done'
@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'
@for i in $(EXECUTABLES); do cd $$i && $(MAKE) clean && cd ..; done @-rm -f $(DEPPATH)/$(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)
@ -22,3 +24,16 @@ dirs:
@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,$(LIBS),$(DEPPATH)/$(PLATFORM)/$(dir))
@mkdir -p $(foreach dir,$(EXECUTABLES),$(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
@$(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'
@echo -n >$(DEPPATH)/$(PLATFORM)/source.lst