-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FULL PROJECT : MAKE FILE , SOURCE AND SUB DIR
- Loading branch information
Showing
11 changed files
with
85 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
PROJECT README : | ||
|
||
|
||
1. Open Terminal in the directory where the "makefile" is. | ||
2. Digit your favourite way to execute the code : | ||
- make all -> Just Compile and put files in sub-directories | ||
- make run -> Compile and Execute Automatically the code | ||
- make run_clean -> Compile and Execute Automatically, after a NORMAL termination , it deletes the Exe and .o files | ||
- make clean -> Just Clean sub-directories | ||
|
||
Sub-Directories : | ||
|
||
exe : Contains Executables and Settings.txt for the game | ||
lib : Contains the libraries | ||
src : Source Container, contains all the C programs and the file "settings.txt" (EDIT THERE THE FILE TO GET THE NEW OPTIONS DONE IF YOU COMPILE AGAIN) | ||
|
||
If you want to Execute the program with the "./name" command, and there is the "settings.txt" inside "exe" folder, you can change it there. | ||
|
||
END FILE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,63 @@ | ||
|
||
FLAGS = -std=c89 -Wpedantic #OPTION FOR EXECUTABLE FILES | ||
OFLAGS = -c -std=c89 -Wpedantic #OPTIONS FOR .o FILE | ||
|
||
FLAGS = -std=c89 -Wpedantic | ||
#OBJ = src/master.c src/player.c src/pawn.c | ||
DEPS = lib/sharedmem.c lib/sharedmem.h #DEPENDENCIES | ||
|
||
EXECUTABLE = main #EXECUTABLE NAME | ||
EXDIR = exe #EXE DIRECTORY | ||
SDIR = src #SOURCE DIRECTORY | ||
|
||
all : master.c player.c pawn.c lib/sharedmem.c lib/sharedmem.h | ||
$(CC) $(FLAGS) master.c lib/sharedmem.c -o main | ||
$(CC) $(FLAGS) player.c lib/sharedmem.c -o player | ||
$(CC) $(FLAGS) pawn.c lib/sharedmem.c -o pawn | ||
LIBDIR = lib #LIBRARY DIRECTORY | ||
LIBNAME = sharedmem.o #LIBRARY NAME AFTER GENERATING .o | ||
|
||
|
||
#BASIC MAKE | ||
all : createdir $(LIBDIR)/$(LIBNAME) $(EXDIR)/$(EXECUTABLE) $(EXDIR)/player $(EXDIR)/pawn copysettings | ||
|
||
#MAKE RUN WITHOUT DELETING AT THE END | ||
run : createdir $(LIBDIR)/$(LIBNAME) $(EXDIR)/$(EXECUTABLE) $(EXDIR)/player $(EXDIR)/pawn copysettings execute | ||
|
||
#MAKE RUN WITH DELETES AT THE END | ||
run_clean : run clean | ||
|
||
#MAKE EXECUTE CAN EXECUTE THE PROGRAM | ||
execute : | ||
cd $(EXDIR);./$(EXECUTABLE) | ||
|
||
#CREATE EXE DIRECTORY IF IT DOESN'T EXISTS YET | ||
createdir : | ||
mkdir -p $(EXDIR) | ||
|
||
#COPY SETTINGS FILE FROM LIB TO EXE | ||
copysettings : | ||
cp $(SDIR)/settings.txt $(EXDIR) | ||
|
||
#CHECK FOR LIBRARIES TO RECOMPILE AND MOVE | ||
$(LIBDIR)/$(LIBNAME): $(DEPS) | ||
$(CC) $(OFLAGS) $(LIBDIR)/sharedmem.c -o $(LIBNAME) | ||
mv $(LIBNAME) $(LIBDIR) | ||
|
||
#CHECK FOR MAIN TO RECOMPILE (MASTER) AND MOVE | ||
$(EXDIR)/$(EXECUTABLE) : src/master.c $(DEPS) | ||
$(CC) $(FLAGS) $(SDIR)/master.c $(LIBDIR)/$(LIBNAME) -o $(EXECUTABLE) | ||
mv $(EXECUTABLE) $(EXDIR) | ||
|
||
#CHECK FOR PLAYER TO RECOMPILE AND MOVE | ||
$(EXDIR)/player : src/player.c $(DEPS) | ||
$(CC) $(FLAGS) $(SDIR)/player.c $(LIBDIR)/$(LIBNAME) -o player | ||
mv player $(EXDIR) | ||
|
||
#CHECK FOR PAWN TO RECOMPILE AND MOVE | ||
$(EXDIR)/pawn : src/pawn.c $(DEPS) | ||
$(CC) $(FLAGS) $(SDIR)/pawn.c $(LIBDIR)/$(LIBNAME) -o pawn | ||
mv pawn $(EXDIR) | ||
|
||
#CLASSIC CLEAN | ||
clean : | ||
rm -f *.o | ||
rm main | ||
rm player | ||
rm pawn | ||
rm -f lib/*.o | ||
rm $(EXDIR)/* | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
|
||
#include "lib/sharedmem.h" | ||
#include "../lib/sharedmem.h" | ||
|
||
|
||
#define intconvert(X) atoi(argv[X]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters