From 48ef8a3fa7f5edfe4a5e5f016d61984e9f72e942 Mon Sep 17 00:00:00 2001 From: anselme16 Date: Thu, 22 Jan 2015 14:14:47 +0100 Subject: [PATCH] changed structure of project, orange must be updated --- Makefile | 23 +++++++++-------------- orange/Makefile | 28 ++++++++++++++++++++++++++++ purple/Makefile | 28 ++++++++++++++++++++++++++++ purple.c => purple/purple.c | 4 ++-- 4 files changed, 67 insertions(+), 16 deletions(-) create mode 100644 orange/Makefile create mode 100644 purple/Makefile rename purple.c => purple/purple.c (98%) diff --git a/Makefile b/Makefile index e7c0c43..e2cdc42 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ CC=gcc +AR=ar rcs +GENERATOR=anselme ifdef SystemRoot RM=del /Q @@ -6,6 +8,7 @@ ifdef SystemRoot BINARY=PixelWars.exe LIB=-lSDL -lm -L./lib FLAGS=-Wall -I./include + LIB_PREFIX=lib else ifeq ($(shell uname), Linux) RM=rm -f @@ -13,28 +16,20 @@ else BINARY=PixelWars LIB=-lSDL -lm FLAGS=-g -Wall + LIB_PREFIX=a endif endif all : $(BINARY) -orange : orange.o +$(BINARY) : orange/orange.$(LIB_PREFIX) purple/purple.$(LIB_PREFIX) PixelWars_$(GENERATOR).$(LIB_PREFIX) + $(CC) PixelWars_$(GENERATOR).$(LIB_PREFIX) orange/orange.$(LIB_PREFIX) purple/purple.$(LIB_PREFIX) -o $(BINARY) $(LIB) -purple : purple.o +PixelWars_$(GENERATOR).$(LIB_PREFIX) : main.o tools.o generator_$(GENERATOR).o + $(AR) PixelWars_$(GENERATOR).$(LIB_PREFIX) main.o tools.o generator_$(GENERATOR).o -main : main.o generator.o tools.o - -$(BINARY) : orange.o purple.o main.o generator.o tools.o - $(CC) main.o generator.o orange.o purple.o tools.o -o $(BINARY) $(LIB) - -anselme : orange.o purple.o main.o generator_anselme.o tools.o - $(CC) main.o generator_anselme.o orange.o purple.o tools.o -o $(BINARY) $(LIB) - -alternate : orange.o purple.o main.o generator_bis.o tools.o - $(CC) main.o generator_bis.o orange.o purple.o tools.o -o $(BINARY) $(LIB) - %.o: %.c $(CC) -o $@ -c $< $(FLAGS) clean : - $(RM) *.o $(BINARY) *.stackdump *~ \ No newline at end of file + $(RM) *.o *.a $(BINARY) *.stackdump *~ \ No newline at end of file diff --git a/orange/Makefile b/orange/Makefile new file mode 100644 index 0000000..0d5b73c --- /dev/null +++ b/orange/Makefile @@ -0,0 +1,28 @@ +CC=gcc +AR=ar rcs +TARGET=orange + +ifdef SystemRoot + RM=del /Q + FixPath=$(subst /,\,$1) + LIB= + FLAGS=-g -Wall + LIB_PREFIX=lib +else + ifeq ($(shell uname), Linux) + RM=rm -f + FixPath=$1 + LIB= + FLAGS=-g -Wall + LIB_PREFIX=a + endif +endif + +all : $(TARGET).$(LIB_PREFIX) + +$(TARGET).$(LIB_PREFIX) : + $(CC) *.c -c $(FLAGS) + $(AR) $(TARGET).$(LIB_PREFIX) *.o + +clean : + $(RM) *.o *.a *.stackdump *~ \ No newline at end of file diff --git a/purple/Makefile b/purple/Makefile new file mode 100644 index 0000000..d0b1626 --- /dev/null +++ b/purple/Makefile @@ -0,0 +1,28 @@ +CC=gcc +AR=ar rcs +TARGET=purple + +ifdef SystemRoot + RM=del /Q + FixPath=$(subst /,\,$1) + LIB= + FLAGS=-g -Wall + LIB_PREFIX=lib +else + ifeq ($(shell uname), Linux) + RM=rm -f + FixPath=$1 + LIB= + FLAGS=-g -Wall + LIB_PREFIX=a + endif +endif + +all : $(TARGET).$(LIB_PREFIX) + +$(TARGET).$(LIB_PREFIX) : + $(CC) *.c -c $(FLAGS) + $(AR) $(TARGET).$(LIB_PREFIX) *.o + +clean : + $(RM) *.o *.a *.stackdump *~ \ No newline at end of file diff --git a/purple.c b/purple/purple.c similarity index 98% rename from purple.c rename to purple/purple.c index cd3663d..d994f8a 100644 --- a/purple.c +++ b/purple/purple.c @@ -1,6 +1,6 @@ #include -#include "team.h" -#include "stdlib.h" +#include "../team.h" +#include // Hello World