Skip to content

Commit

Permalink
revise makefile before chapter 13 to add new cpp files ; add empty ma…
Browse files Browse the repository at this point in the history
…in function to make the cpp file compiled.
  • Loading branch information
mudongliang committed Mar 7, 2015
1 parent 338070e commit ca8606d
Show file tree
Hide file tree
Showing 17 changed files with 87 additions and 52 deletions.
2 changes: 1 addition & 1 deletion ch05/makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cutable files for this directory
OBJECTS = ex5_10 ex5_11 ex5_12 ex5_14 ex5_17 ex5_19 ex5_20 ex5_21 \
OBJECTS = ex5_10 ex5_11 ex5_12 ex5_14 ex5_14_1 ex5_17 ex5_19 ex5_20 ex5_21 \
ex5_23 ex5_24 ex5_25 ex5_5 ex5_6 ex5_9

all:$(OBJECTS)
Expand Down
7 changes: 2 additions & 5 deletions ch07/makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
#cutable files for this directory
OBJECTS = ex7_01 ex7_03 ex7_07 ex7_11 ex7_13 ex7_27_TEST \
ex7_43
#
OTHOBJS = ex7_41_TEST ex7_26.o
ex7_43
OTHOBJS = ex7_41_TEST

all: $(OBJECTS) $(OTHOBJS)

ex7_41_TEST:ex7_41_TEST.o ex7_41.o
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ ex7_41_TEST.o ex7_41.o

ex7_26.o:ex7_26.cpp
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ -c $<
# tells make to use the file "../GNU_makefile_template", which
# defines general rules for making .o and files
include ../GNU_makefile_template
Expand Down
3 changes: 2 additions & 1 deletion ch08/makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#cutable files for this directory
OBJECTS = ex8_02 ex8_04 ex8_05 ex8_09 ex8_10 ex8_11 \
#ex8_13
ex8_13
OTHOBJS = ex8_06 ex8_07 ex8_08

all:$(OBJECTS) $(OTHOBJS)

ex8_06 : ex8_06.o ../ch07/ex7_26.o
Expand Down
2 changes: 1 addition & 1 deletion ch09/makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#cutable files for this directory
OBJECTS = ex9_13 ex9_14 ex9_15 ex9_16 ex9_18 ex9_19 ex9_20 ex9_24 \
OBJECTS = ex9_13 ex9_14 ex9_15 ex9_16 ex9_18 ex9_19 ex9_20 ex9_22 ex9_24 \
ex9_26 ex9_27 ex9_31_1 ex9_31_2 ex9_32 ex9_33 ex9_34 ex9_38 \
ex9_41 ex9_43 ex9_44 ex9_45 ex9_46 ex9_47_1 ex9_47_2 ex9_49 \
ex9_50 ex9_51 ex9_52
Expand Down
8 changes: 7 additions & 1 deletion ch12/ex12_22.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@ ConstStrBlobPtr StrBlob::begin() const // should add const
ConstStrBlobPtr StrBlob::end() const // should add const
{
return ConstStrBlobPtr(*this, data->size());
}
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch12/ex12_32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ std::ostream& print(std::ostream &out, const QueryResult& qr)
}
return out;
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch12/ex12_33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@ std::ostream& print(std::ostream &out, const QueryResult& qr)
}
return out;
}

int main()
{

return 0;
}
19 changes: 8 additions & 11 deletions ch12/makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
# executable files for this directory
OBJECTS = ex12_06 ex12_07 ex12_10 ex12_11 ex12_13 ex12_14 ex12_15 \
ex12_16 ex12_23 ex12_24 ex12_26 ex12_28

OBJECTS = ex12_06 ex12_07 ex12_10 ex12_11 ex12_12 ex12_13 ex12_14 ex12_15 \
ex12_16 ex12_17_18 ex12_22 ex12_23 ex12_24 ex12_26 ex12_28 ex12_32 ex12_33
OTHOBJS = ex12_20 ex12_27_30_TEST

all:$(OBJECTS) $(OTHOBJS)

# tells make to use the file "../GNU_makefile_template", which
# defines general rules for making .o and .exe files
include ../GNU_makefile_template

ex12_20: ex12_20.o ex12_19.o
$(CC) $(CCFLAGS) $(LOCFLAGS) ex12_20.o ex12_19.o \
-o $@
$(CC) $(CCFLAGS) $(LOCFLAGS) $^ -o $@

ex12_27_30_TEST: ex12_27_30_TEST.o ex12_27_30.o
$(CC) $(CCFLAGS) $(LOCFLAGS) ex12_27_30_TEST.o ex12_27_30.o \
-o $@
$(CC) $(CCFLAGS) $(LOCFLAGS) $^ -o $@

# tells make to use the file "../GNU_makefile_template", which
# defines general rules for making .o and .exe files
include ../GNU_makefile_template
8 changes: 7 additions & 1 deletion ch13/ex13_18.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@ Employee::Employee() {
Employee::Employee(const string &name) {
id_ = s_increment++;
name_ = name;
}
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_26.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ StrBlob& StrBlob::operator=(const StrBlob& sb)
data = std::make_shared<vector<string>>(*sb.data);
return *this;
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ BinStrTree& BinStrTree::operator=(const BinStrTree &bst)
root = new_root;
return *this;
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_34_36_37.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,9 @@ void Folder::print_debug()
std::cout << m->contents << " ";
std::cout << std::endl;
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_39.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,9 @@ void StrVec::resize(size_t count, const std::string &s)
alloc.destroy(--first_free);
}
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_40.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,9 @@ void StrVec::resize(size_t count, const std::string &s)
alloc.destroy(--first_free);
}
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_44_47.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ String& String::operator = (const String &rhs)
std::cout << "copy-assignment" << std::endl;
return *this;
}

int main()
{

return 0;
}
6 changes: 6 additions & 0 deletions ch13/ex13_53.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ HasPtr::~HasPtr()
std::cout << "call destructor" << std::endl;
delete ps;
}

int main()
{

return 0;
}
36 changes: 5 additions & 31 deletions ch13/makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,16 @@
#cutable files for this directory
OBJECTS = ex13_13 ex13_17 ex13_58
OTHOBJS = ex13_42
# ex13_48 : can not compile successfully!
# ex13_28 ex13_26 ex13_18 ex13_34_36_37 ex13_44_47 ex13_53 : no main function!
# ex13_42_StrVec ex13_49_Message ex13_49_String ex13_49_StrVec : no main function!
# ex13_39 ex13_40 : no StrVec.h and correspending header file is useless!
OBJECTS = ex13_13 ex13_17 ex13_58 \
ex13_28 ex13_26 ex13_18 ex13_34_36_37 ex13_39 ex13_40 ex13_44_47 ex13_53
OTHOBJS = ex13_42 ex13_48
# ex13_49_Message ex13_49_String ex13_49_StrVec
all:$(OBJECTS) $(OTHOBJS)

#list the header file after cpp file to show the dependency!
ex13_18 : ex13_18.cpp ex13_18.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_26 : ex13_26.cpp ex13_26.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_28 : ex13_28.cpp ex13_28.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_34_36_37 : ex13_34_36_37.cpp ex13_34_36_37.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_39 : ex13_39.cpp ex13_39.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_40 : ex13_40.cpp ex13_40.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_42 : ex13_42.o ex13_42_TextQuery.o ex13_42_StrVec.o ex13_42_TextQuery.h ex13_42_StrVec.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $^

ex13_44_47 : ex13_44_47.cpp ex13_44_47.h
ex13_48 : ex13_44_47.cpp ex13_44_47.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_48 : ex13_48.cpp ex13_44_47.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<

ex13_53 : ex13_53.cpp ex13_53.h
$(CC) $(CCFLAGS) $(LOCFLAGS) -o $@ $<
# tells make to use the file "../GNU_makefile_template", which
# defines general rules for making .o and files
include ../GNU_makefile_template

0 comments on commit ca8606d

Please sign in to comment.