From c18371da076a46215a286054a31b20b22104162b Mon Sep 17 00:00:00 2001 From: josh Date: Sat, 4 Apr 2009 17:21:38 +0000 Subject: [PATCH] reworked Makefile system, renamed *.cpp to *.cc git-svn-id: svn://anubis/jcad/trunk@33 c8684bfa-0c3a-0410-9efb-b8c82542f01e --- src/Makefile | 7 ++-- src/engine/Makefile | 41 ++++++++----------- src/engine/{Profile.cpp => Profile.cc} | 0 src/gui/{Displayer.cpp => Displayer.cc} | 0 src/gui/{GUI.cpp => GUI.cc} | 0 src/gui/{MainWindow.cpp => MainWindow.cc} | 0 src/gui/Makefile | 41 ++++++++----------- .../{PartDisplayer.cpp => PartDisplayer.cc} | 0 ...ofileDisplayer.cpp => ProfileDisplayer.cc} | 0 src/main/Makefile | 37 ++++++++--------- src/main/{main.cpp => jcad.cc} | 0 11 files changed, 55 insertions(+), 71 deletions(-) rename src/engine/{Profile.cpp => Profile.cc} (100%) rename src/gui/{Displayer.cpp => Displayer.cc} (100%) rename src/gui/{GUI.cpp => GUI.cc} (100%) rename src/gui/{MainWindow.cpp => MainWindow.cc} (100%) rename src/gui/{PartDisplayer.cpp => PartDisplayer.cc} (100%) rename src/gui/{ProfileDisplayer.cpp => ProfileDisplayer.cc} (100%) rename src/main/{main.cpp => jcad.cc} (100%) diff --git a/src/Makefile b/src/Makefile index 43e8543..b119621 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,6 @@ SHELL := bash +TARGET := jcad export GTKMM_VERSION := 2.4 export GTKGLEXTMM_VERSION := 1.2 @@ -9,14 +10,14 @@ export CPPFLAGS += -I"$(shell cd)" else export CPPFLAGS += -I"$(shell pwd)" endif -export CXXFLAGS := -Wall -O2 +export CXXFLAGS := -Wall -O2 \ + `pkg-config --cflags gtkmm-$(GTKMM_VERSION)` \ + `pkg-config --cflags gtkglextmm-$(GTKGLEXTMM_VERSION)` export LDFLAGS := `pkg-config --libs gtkmm-$(GTKMM_VERSION)` \ `pkg-config --libs gtkglextmm-$(GTKGLEXTMM_VERSION)` SUBDIRS := engine gui main -all: $(TARGET) - .PHONY: $(TARGET) $(TARGET): @for d in $(SUBDIRS); \ diff --git a/src/engine/Makefile b/src/engine/Makefile index 544f762..a210eec 100644 --- a/src/engine/Makefile +++ b/src/engine/Makefile @@ -1,30 +1,23 @@ -SRCS := Profile.cpp -MODULES := Profile.o -TARGET := engine.a -GTKMM_VERSION := 2.4 -GTKGLEXTMM_VERSION := 1.2 -CPPFLAGS = -I.. -CXXFLAGS = -O2 $(CPPFLAGS) \ - `pkg-config --cflags gtkmm-$(GTKMM_VERSION)` \ - `pkg-config --cflags gtkglextmm-$(GTKGLEXTMM_VERSION)` -DEPS := $(SRCS:.cpp=.d) +OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc)) +DEPS := $(OBJS:.o=.dep) -all: $(TARGET) +all: $(DEPS) $(OBJS) -$(TARGET): $(MODULES) - $(AR) rcv $@ $? +%.o: %.cc + $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< -%.o: %.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - -.PHONY: clean -clean: - $(RM) -f *.o *.d *~ $(TARGET) - -%.d: %.cpp +# Make dependency files +%.dep: %.cc @set -e; rm -f $@; \ - $(CXX) -MM $(CPPFLAGS) $< | \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ + $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ -include $(DEPS) +clean: + -$(RM) -f *.o *.dep + +# Include dependency files +ifndef CLEAN +-include $(DEPS) +endif diff --git a/src/engine/Profile.cpp b/src/engine/Profile.cc similarity index 100% rename from src/engine/Profile.cpp rename to src/engine/Profile.cc diff --git a/src/gui/Displayer.cpp b/src/gui/Displayer.cc similarity index 100% rename from src/gui/Displayer.cpp rename to src/gui/Displayer.cc diff --git a/src/gui/GUI.cpp b/src/gui/GUI.cc similarity index 100% rename from src/gui/GUI.cpp rename to src/gui/GUI.cc diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cc similarity index 100% rename from src/gui/MainWindow.cpp rename to src/gui/MainWindow.cc diff --git a/src/gui/Makefile b/src/gui/Makefile index ccf3227..a210eec 100644 --- a/src/gui/Makefile +++ b/src/gui/Makefile @@ -1,30 +1,23 @@ -SRCS := MainWindow.cpp GUI.cpp Displayer.cpp ProfileDisplayer.cpp PartDisplayer.cpp -MODULES := MainWindow.o GUI.o Displayer.o ProfileDisplayer.o PartDisplayer.o -TARGET := gui.a -GTKMM_VERSION := 2.4 -GTKGLEXTMM_VERSION := 1.2 -CPPFLAGS = -I.. -CXXFLAGS = -O2 $(CPPFLAGS) \ - `pkg-config --cflags gtkmm-$(GTKMM_VERSION)` \ - `pkg-config --cflags gtkglextmm-$(GTKGLEXTMM_VERSION)` -DEPS := $(SRCS:.cpp=.d) +OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc)) +DEPS := $(OBJS:.o=.dep) -all: $(TARGET) +all: $(DEPS) $(OBJS) -$(TARGET): $(MODULES) - $(AR) rcv $@ $? +%.o: %.cc + $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< -%.o: %.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - -.PHONY: clean -clean: - $(RM) -f *.o *.d *~ $(TARGET) - -%.d: %.cpp +# Make dependency files +%.dep: %.cc @set -e; rm -f $@; \ - $(CXX) -MM $(CPPFLAGS) $< | \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ + $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ -include $(DEPS) +clean: + -$(RM) -f *.o *.dep + +# Include dependency files +ifndef CLEAN +-include $(DEPS) +endif diff --git a/src/gui/PartDisplayer.cpp b/src/gui/PartDisplayer.cc similarity index 100% rename from src/gui/PartDisplayer.cpp rename to src/gui/PartDisplayer.cc diff --git a/src/gui/ProfileDisplayer.cpp b/src/gui/ProfileDisplayer.cc similarity index 100% rename from src/gui/ProfileDisplayer.cpp rename to src/gui/ProfileDisplayer.cc diff --git a/src/main/Makefile b/src/main/Makefile index 2a3d888..a210eec 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -1,26 +1,23 @@ -SRCS := main.cpp -MODULES := main.o -TARGET := main.a -DEPS := $(SRCS:.cpp=.d) -CPPFLAGS := -I.. -CXXFLAGS := -O2 $(CPPFLAGS) +OBJS := $(patsubst %.cc,%.o,$(wildcard *.cc)) +DEPS := $(OBJS:.o=.dep) -all: $(TARGET) +all: $(DEPS) $(OBJS) -$(TARGET): $(MODULES) - $(AR) rcv $@ $? +%.o: %.cc + $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< -%.o: %.cpp - $(CXX) -c -o $@ $(CXXFLAGS) $< - -.PHONY: clean -clean: - $(RM) -f *.o *.d *~ $(TARGET) - -%.d: %.cpp +# Make dependency files +%.dep: %.cc @set -e; rm -f $@; \ - $(CXX) -MM $(CPPFLAGS) $< | \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' > $@ + $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ -include $(DEPS) +clean: + -$(RM) -f *.o *.dep + +# Include dependency files +ifndef CLEAN +-include $(DEPS) +endif diff --git a/src/main/main.cpp b/src/main/jcad.cc similarity index 100% rename from src/main/main.cpp rename to src/main/jcad.cc