# [--------------------DIRECTORIES--------------------] # SRC_DIR is the source directory # OBJ_DIR is the object directory # INC_DIR is the header directory SRC_DIR := src OBJ_DIR := obj INC_DIR := inc BIN_DIR := bin # [--------------------COMPILE & RUN--------------------] # CXX is the keyword to compile .c src files # WFLAG is a flag to detect all the warnings # OFLAG is the flag to rename the output of the compiler # TARGET is the name of the output # INCLUDE add to g++ path the custom include path CXX := gcc WFLAGS := -Wall OFLAG := -o TARGET1 := $(BIN_DIR)/F4Server TARGET2 := $(BIN_DIR)/F4Client INCLUDE := -I $(INC_DIR) # [--------------------FUNCTION--------------------] # SRCS extract all file in src/ # FILES extract the name of the file # OBJS concat obj/ + FILES + .o SRCS := $(shell find $(SRC_DIR) -name "*.c") FILES := $(notdir $(basename $(SRCS))) OBJS := $(addprefix $(OBJ_DIR)/,$(addsuffix .o,$(FILES))) MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) MKFILE_DIR := $(dir $(mkfile_path)) ARGSSERVER := 6 7 O X ARGSCLIENT1 := Test1 ARGSCLIENT2 := Test2 TERMINAL_ARGS1 := --geometry=90x30 -e TERMINAL_ARGS2 := --geometry=10x30 -e OPEN_NEW_TERMINAL := x-terminal-emulator # OPEN_NEW_TERMINAL := kitty test: comp @ ipcrm --all=sem @ ipcrm --all=msg @ ipcrm --all=shm @ # $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS1) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT1) @ # $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS2) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT2) @ # ./$(TARGET1) $(ARGSSERVER) comp: server_c client_c server_c: @ mkdir bin -p gcc src/F4Server.c src/custom_sem.c src/custom_shm.c src/custom_sig.c src/custom_msgq.c src/errExit.c src/forza4.c src/client.c src/server.c -o bin/F4Server -I inc/ client_c: gcc src/F4Client.c src/custom_sem.c src/custom_shm.c src/custom_sig.c src/custom_msgq.c src/errExit.c src/forza4.c src/client.c src/server.c -o bin/F4Client -I inc/