From f1f23b0047bf11eb8f904f4da4e5cc2bb236bf06 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 15 Sep 2011 23:40:27 +0300 Subject: [PATCH] Another way of splitting c- and cpp- files --- projects/stargazer/plugins/Makefile.in | 14 +++++++++++--- stglibs/Makefile.in | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/projects/stargazer/plugins/Makefile.in b/projects/stargazer/plugins/Makefile.in index 2b255304..faee2ad8 100644 --- a/projects/stargazer/plugins/Makefile.in +++ b/projects/stargazer/plugins/Makefile.in @@ -9,6 +9,7 @@ OBJS = $(notdir $(patsubst %.cpp, %.o, $(patsubst %.c, %.o, $(SRCS)))) LN = ln CXXFLAGS += -fPIC +CFLAGS += -fPIC LDFLAGS += -shared -L$(DIR_LIB) -Wl,-rpath,$(PREFIX)/usr/lib/stg vpath %.a $(DIR_LIB) @@ -38,6 +39,13 @@ endif deps: $(SRCS) ../../../../../Makefile.conf @>deps ;\ for file in $(SRCS); do\ - echo "`$(CC) $(CXXFLAGS) $(DEFS) $(SEARCH_DIRS) -MM $$file` Makefile ../../../../../Makefile.conf" >> deps ;\ - echo -e '\t$$(CC) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\ - done + echo "$$file" | grep ".c$$" > /dev/null;\ + if [ $$? == 0 ];\ + then\ + echo "`$(CC) $(CFLAGS) $(DEFS) $(SEARCH_DIRS) -MM $$file` Makefile ../../../../../Makefile.conf" >> deps ;\ + echo -e '\t$$(CC) -c $$< $(CFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\ + else\ + echo "`$(CXX) $(CXXFLAGS) $(DEFS) $(SEARCH_DIRS) -MM $$file` Makefile ../../../../../Makefile.conf" >> deps ;\ + echo -e '\t$$(CXX) -c $$< $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS)' >> deps ;\ + fi;\ + done; diff --git a/stglibs/Makefile.in b/stglibs/Makefile.in index d86cac3c..a016fed5 100644 --- a/stglibs/Makefile.in +++ b/stglibs/Makefile.in @@ -64,12 +64,15 @@ endif deps: $(SRCS) ../../Makefile.conf @>deps ;\ - for file in `echo "$(SRCS)" | grep ".c$$"`; do\ - echo "`$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\ - echo -e '\t$$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\ - done;\ - for file in `echo "$(SRCS)" | grep ".cpp$$"`; do\ - echo "`$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\ - echo -e '\t$$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\ - done\ + for file in $(SRCS); do\ + echo "$$file" | grep ".c$$" > /dev/null;\ + if [ $$? == 0 ];\ + then\ + echo "`$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\ + echo -e '\t$$(CC) $(CFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\ + else\ + echo "`$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -MM $$file` Makefile ../../Makefile.conf" >> deps ;\ + echo -e '\t$$(CXX) $(CXXFLAGS) $(SEARCH_DIRS) $(DEFS) -c $$<' >> deps ;\ + fi;\ + done -- 2.44.2