Elaborato_SO/Makefile

59 lines
1.9 KiB
Makefile
Raw Permalink Normal View History

2023-05-14 16:05:37 +02:00
# [--------------------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
2023-05-14 17:16:12 +02:00
BIN_DIR := bin
2023-05-14 16:05:37 +02:00
# [--------------------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
2023-05-14 16:05:37 +02:00
INCLUDE := -I $(INC_DIR)
2023-05-16 18:43:56 +02:00
2023-05-14 16:05:37 +02:00
# [--------------------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)))
2023-05-17 14:45:05 +02:00
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
MKFILE_DIR := $(dir $(mkfile_path))
2023-05-17 14:38:44 +02:00
2023-05-23 12:11:39 +02:00
ARGSSERVER := 6 7 O X
2023-05-26 15:23:59 +02:00
ARGSCLIENT1 := Test1
ARGSCLIENT2 := Test2
2023-05-31 11:00:59 +02:00
TERMINAL_ARGS1 := --geometry=90x30 -e
TERMINAL_ARGS2 := --geometry=10x30 -e
2023-06-18 15:54:51 +02:00
OPEN_NEW_TERMINAL := x-terminal-emulator
# OPEN_NEW_TERMINAL := kitty
2023-05-16 18:46:41 +02:00
2023-06-17 14:31:24 +02:00
test: comp
2023-06-18 15:54:51 +02:00
@ ipcrm --all=sem
@ ipcrm --all=msg
@ ipcrm --all=shm
2023-06-18 16:06:02 +02:00
@ # $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS1) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT1)
@ # $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS2) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT2)
@ # ./$(TARGET1) $(ARGSSERVER)
2023-05-17 14:46:16 +02:00
comp: server_c client_c
2023-05-17 14:38:44 +02:00
2023-06-18 16:06:02 +02:00
server_c:
2023-06-18 16:13:05 +02:00
@ mkdir bin -p
2023-06-18 15:58:16 +02:00
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/
2023-06-18 16:06:02 +02:00
client_c:
2023-06-18 15:58:16 +02:00
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/