Final version

This commit is contained in:
Christos Houtouridis
2019-10-09 23:03:29 +03:00
parent 3ec3db11c9
commit a452f2e27c
9 changed files with 122 additions and 76 deletions
+40 -16
View File
@@ -6,21 +6,45 @@
#
#
# select one of the following or edit for your environment
# Edit the paths to match your environment
# Currently supported:
# Windows (we prefer Cygwin)
# GNU/Linux
#
LINUX_CXX := /usr/local/bin/cross-pi0/bin/arm-linux-gnueabihf-gcc
WIN_CXX := D:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe
#CXX := /usr/local/arm/bin/arm-unknown-linux-gnueabi-gcc
CXX := D:\SysGCC\raspberry\bin\arm-linux-gnueabihf-gcc.exe
# RTES related stuff for upload
SCP := scp
PIUSER := root
PI := 192.168.0.1
RTES_PATH := /usr/local/bin/
CXXFLAGS := -std=c11 -Wall -Wextra -Werror
CXXFEXTR := -c -fmessage-length=0
LDFLAGS := -lm -lpthread
BUILD := ./bin
OBJ_DIR := $(BUILD)/obj
APP_DIR := $(BUILD)
TARGET := rtes_final
SRC := $(wildcard src/*.c)
# === Compilation related stuff ===
CXXFLAGS := -std=c11 -Wall -Wextra -Werror
CXXFEXTR := -c -fmessage-length=0
LDFLAGS := -lm -lpthread
BUILD := ./bin
OBJ_DIR := $(BUILD)/obj
APP_DIR := $(BUILD)
TARGET := rtes_final
SRC := $(wildcard src/*.c)
# === OS selection ===
ifeq ($(OS),Windows_NT)
# Windows, select exe path
CXX := $(WIN_CXX)
else
# Linux filter [currently only GNU/Linux]
UNAME := $(shell uname)
ifeq ($(UNAME),Linux)
CXX := $(LINUX_CXX)
else
ERR := $(error Not supporting OS)
endif
endif
# === MakeFile body ===
OBJECTS := $(SRC:%.c=$(OBJ_DIR)/%.o)
$(OBJ_DIR)/%.o: %.c
@@ -34,6 +58,10 @@ $(APP_DIR)/$(TARGET): $(OBJECTS)
# === Rules ===
rtes_final: build $(APP_DIR)/$(TARGET)
clean:
-@rm -rvf $(OBJ_DIR)/*
-@rm -rvf $(APP_DIR)/*
build:
@mkdir -p $(APP_DIR)
@mkdir -p $(OBJ_DIR)
@@ -45,11 +73,7 @@ release: CXXFLAGS += -O2
release: rtes_final
upload:
scp $(BUILD)/$(TARGET) root@192.168.0.1:/root/
clean:
-@rm -rvf $(OBJ_DIR)/*
-@rm -rvf $(APP_DIR)/*
$(SCP) $(BUILD)/$(TARGET) $(PIUSER)@$(PI):$(RTES_PATH)
all: clean release upload