diff --git a/Makefile b/Makefile index 8c308ca..2ce1502 100644 --- a/Makefile +++ b/Makefile @@ -1,36 +1,27 @@ TARGET = lib/libguisan.a -#compile and lib parameter AR = ar + DIRS =$(shell find ./src -maxdepth 3 -type d) -FILES = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.cpp)) -INCLUDE =-I./include -CFLAGS := -g -w -O3 $(INCLUDE) -CXXFLAGS:= $(CFLAGS) -#i think you should do anything here - -#source file -SOURCE = $(FILES) +SOURCE = $(foreach dir,$(DIRS),$(wildcard $(dir)/*.cpp)) OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(SOURCE))) + +INCLUDE =-I./include +CFLAGS = -g -w -O3 $(INCLUDE) +CXXFLAGS= $(CFLAGS) -.PHONY : everything objs clean veryclean rebuild -everything : $(TARGET) - -all : $(TARGET) - cd demo && make && cd .. - cd examples && make && cd .. - -objs : $(OBJS) - -rebuild: everything - -clean : - find . -name *.o |xargs rm -f - rm -rf $(TARGET) - cd demo && make clean && cd .. - cd examples && make clean && cd .. +.PHONY : all clean $(TARGET) : $(OBJS) $(AR) cr $(TARGET) $(OBJS) +all : $(TARGET) + cd demo&&make all&&cd .. + cd examples&&make all&&cd .. + +clean : + cd demo&&make clean&&cd .. + cd examples&&make clean&&cd .. + find . -name *.o |xargs rm -f + rm -rf $(TARGET) diff --git a/examples/Makefile b/examples/Makefile index 2f98703..2f79ae1 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,21 +1,22 @@ CC =g++ INCLUDE =-I../include -CXXFLAGS=-g -w -O3 $(INCLUDE) -LIBS =../lib/libguisan.a -LDLIBS =-lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer +LDFLAGS =-L../lib +LIBS =-lSDL2_ttf -lSDL2_mixer -lguisan -lSDL2_image -lSDL2 +CFLAGS =-g -w -O3 $(INCLUDE) $(LDFLAGS) +CXXFLAGS=$(CFLAGS) .PHONY:all clean - + all :sdlhelloworld sdlaction sdlwidgets sdlhelloworld:sdlhelloworld.o - $(CC) sdlhelloworld.cpp $(LIBS) $(INCLUDE) -o sdlhelloworld $(LDLIBS) + $(CC) $(CXXFLAGS) -o sdlhelloworld sdlhelloworld.o $(LIBS) sdlaction:sdlaction.o - $(CC) sdlaction.cpp $(LIBS) $(INCLUDE) -o sdlaction $(LDLIBS) + $(CC) $(CXXFLAGS) -o sdlaction sdlaction.o $(LIBS) sdlwidgets:sdlwidgets.o - $(CC) sdlwidgets.cpp $(LIBS) $(INCLUDE) -o sdlwidgets $(LDLIBS) + $(CC) $(CXXFLAGS) -o sdlwidgets sdlwidgets.o $(LIBS) clean: rm -rf sdlhelloworld sdlaction sdlwidgets *.o diff --git a/examples/sdlaction b/examples/sdlaction deleted file mode 100755 index 2cfb9dc..0000000 Binary files a/examples/sdlaction and /dev/null differ diff --git a/examples/sdlhelloworld b/examples/sdlhelloworld deleted file mode 100755 index 35939a9..0000000 Binary files a/examples/sdlhelloworld and /dev/null differ diff --git a/examples/sdlwidgets b/examples/sdlwidgets deleted file mode 100755 index cdafc6a..0000000 Binary files a/examples/sdlwidgets and /dev/null differ diff --git a/lib/libguisan.a b/lib/libguisan.a deleted file mode 100644 index 731010a..0000000 Binary files a/lib/libguisan.a and /dev/null differ