Skip to content

Commit

Permalink
new makefile! faster and better. no need to recompile over and over a…
Browse files Browse the repository at this point in the history
…gain. just check howto in file. also I added an int casting inside page.cpp
  • Loading branch information
liranbg committed Mar 25, 2014
1 parent 9361777 commit 92c31fe
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 36 deletions.
8 changes: 4 additions & 4 deletions Page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int Page::findTitle(string& from, int index)
{
cout << "**** in findTitle ****" << endl; //** DEBUG **
string temp;
while(index < from.length())
while(index < (int)from.length())
{
if(from[index] == '<')
{
Expand Down Expand Up @@ -83,7 +83,7 @@ int Page::runToActualText(string& from, int index)
{
cout << "**** in runToActualText ****" << endl; //**DEBUG**
cout << "**** index: "<< index <<" ****" << endl; //**DEBUG**
while(index < from.length())
while(index < (int)from.length())
{
if(from[index] == '<')
{
Expand Down Expand Up @@ -114,7 +114,7 @@ void Page::manageTableContent(string& html, int index)
* Actual Body Text In String
*/
string temp;
for (int i = index; i < html.length(); i++)
for (int i = index; i < (int)html.length(); i++)
{
if(html[i] == '<')
{
Expand Down Expand Up @@ -160,7 +160,7 @@ int Page::stitchText(string& from, string& to, int index)
}


while(from[index] != '<' && index < from.length())
while(from[index] != '<' && index < (int)from.length())
{
if(from[index] == '&')
{
Expand Down
14 changes: 8 additions & 6 deletions jce.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
#ifndef JCE_H
#define JCE_H

#define dst_host "yedion.jce.ac.il"
#define dst_port 443

#include "sslsocket.h"
#include "Page.h"
#include "user.h"
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>

#include "sslsocket.h"
#include "user.h"
#include "Page.h"
#include "GradePage.h"

#define dst_host "yedion.jce.ac.il"
#define dst_port 443

enum jceErrors {
VALIDATION_ERROR,
OKOK,
SOCKET_ERROR,
NO_INPUT_ERROR
};
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

int main(int argc, char *argv[])
{
jce *curr_user = new jce();
jce curr_user;
while (true);

}
8 changes: 1 addition & 7 deletions main.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef MAIN_H
#define MAIN_H

//#include "socket.h"
#include "jce.h"
//#define dst_host "www.google.co.il"
//#define dst_port 443

// #define dst_host "yedion.jce.ac.il"
// #define dst_port 443

#endif // MAIN_H
#endif // MAIN_H
51 changes: 33 additions & 18 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,39 +1,54 @@

#HOW-TO:
# make to compile
# make clean cleaning objects directory
# make bclean cleaning all files
# make rebuild clean and remake

# compiler
CC=g++

# compile arguments
CFLAGS+= -Wall -g -fexceptions -std=c++11 -D_REENTRANT -pthread
CFLAGS = -Wall -g -fexceptions -std=c++11 -D_REENTRANT -pthread

# linker flags
LDFLAGS+= -g -std=c++11
LDFLAGS = -g -std=c++11

# libraries
LIBS+= -lcrypto -lssl
LIBS = -lcrypto -lssl

# our source files
SOURCES=main.cpp socket.cpp sslsocket.cpp jce.cpp Page.cpp user.cpp GradePage.cpp GradePage.h Course.cpp Course.h
#our source files
SOURCES=$(wildcard *.cpp)

# a macro to define the objects from sources
OBJECTS=$(SOURCES:.c=.o)
BUILD_DIR := build
OBJC=$(SOURCES:%.cpp=${BUILD_DIR}/%.o)

# executable name
EXECUTABLE=jce

$(EXECUTABLE): $(OBJECTS)
.PHONY: all

all: $(EXECUTABLE)

$(EXECUTABLE): $(OBJC)
@echo "Building target" $@ "..."
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
@echo "Done!"

@$(CC) $(LDFLAGS) -o $@ $(OBJC) $(LIBS)

# a rule for generating object files given their c files
.c.o:
@echo "Compiling" $< "..."
$(CC) $(CFLAGS) $< -o $@
@echo "Done!"
#.cpp.o: /$(OBJCDIR)
${BUILD_DIR}/%.o: %.cpp
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@

clean:
@echo "Ceaning up *.o Files..."
rm -rf *s *o $(EXECUTABLE)
@echo "Done!"
@rm -rf ${BUILD_DIR}

bclean:
@echo "Ceaning all"
@rm -rf $(EXECUTABLE) ${BUILD_DIR}

rebuild: clean all


.PHONY: all clean

0 comments on commit 92c31fe

Please sign in to comment.