From 4e6026b12eb00ea5bdd6dece2dfc97ffe8c2fc87 Mon Sep 17 00:00:00 2001 From: hybrid Date: Fri, 26 Jun 2026 21:29:22 +0300 Subject: add: Makefile, context.h --- Makefile | 45 +++++++++++++++++++++++++++++++++++++++++++++ include/context.h | 34 ++++++++++++++++++++++++++++++++++ src/main.c | 10 ++++------ 3 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 Makefile create mode 100644 include/context.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..252bf6d --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +CC := /usr/bin/gcc +CFLAGS = -Wall -Wpedantic -I$(INC_DIR) +LDLIBS := + +# DIRS +BASE_DIR = $(pwd) +SRC_DIR = src +BIN_DIR = bin +OBJ_DIR = obj +#LIB_DIR := lib +BUILD_DIR = build +INC_DIR = include + +# TARGETS +TARGET := $(BIN_DIR)/catragmx +SOURCES := $(wildcard $(SRC_DIR)/*.c) +OBJECTS := $(SOURCES:$(SRC_DIR)/%.c=$(BUILD_DIR)%.o) + +# ALL TARGET +all: $(TARGET) + +# COMPILE MAIN TARGET +$(TARGET): $(SOURCES) | $(BIN_DIR) + $(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ $(LDLIBS) + +# COMPILE OBJECTS +$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c | $(BUILD_DIR) + $(CC) $(CFLAGS) -c $< -o $@ + +# MAKE DIRS +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(BIN_DIR): + mkdir -p $(BIN_DIR) + +# CLEAN +clean: + rm -rf $(BIN_DIR) + rm -rf $(BUILD_DIR) + +distclean: clean + git submodule deinit --all -f + +.PHONY: all clean diff --git a/include/context.h b/include/context.h new file mode 100644 index 0000000..95580ee --- /dev/null +++ b/include/context.h @@ -0,0 +1,34 @@ +#include + +typedef enum { + ATM_1, + ATM_2 +} ATM_MODEL; + +typedef struct { + float scope_angle; + float bullet_mass; + float bore_height; + float muzzle_vel; + float ballistic_coef; + size_t drag_model; + float twist_dir; +} gun_config; + +typedef struct { + float termperature; + float bar_pressure; + float rel_humidity; + float wind_speed; + size_t wind_dir; + ATM_MODEL atmosphere_model; +} atmo_context; + +typedef struct { + float target_speed; + float target_range; +} target_context; + +typedef struct { + gun_config gun; +} ATragMXSolution; diff --git a/src/main.c b/src/main.c index 7a6182c..01be95f 100644 --- a/src/main.c +++ b/src/main.c @@ -1,10 +1,8 @@ #include #include -typedef struct { +#include "context.h" -} gun_config; - -typedef struct { - gun_config gun; -} ATragMXSolution; +int main(int argc, char** argv) { + printf("Hello, %s\n", argv[0]); +} -- cgit v1.3.1