HAL Compile (makefile)
- BIBIGUL
- Away
- New Member
-
Less
More
- Posts: 4
- Thank you received: 0
14 Feb 2026 13:17 #342935
by BIBIGUL
HAL Compile (makefile) was created by BIBIGUL
A question about compilation. Wrote such a makefile -
MODULE_NAME := Name
MODINC := /usr/share/linuxcnc/Makefile.modinc
SRC_DIR := Src
INC_DIR := Inc
SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES := $(notdir $(SRC_FILES:.c=.o))
$(MODULE_NAME)-objs := $(OBJ_FILES)
obj-m += $(MODULE_NAME).o
export BUILD_VERBOSE := 1
include $(MODINC)
EXTRA_CFLAGS += -I$(shell pwd)/$(SRC_DIR)
EXTRA_CFLAGS += -I$(shell pwd)/$(INC_DIR)
EXTRA_CFLAGS += -O2
EXTRA_CFLAGS += -march=x86-64
EXTRA_CFLAGS += -mtune=generic
EXTRA_CFLAGS += -fno-fast-math
EXTRA_CFLAGS += -fno-unsafe-math-optimizations
%.o: $(SRC_DIR)/%.c
$(CC) $(EXTRA_CFLAGS) -c $< -o $@
all:
make -S modules
clean:
rm -f *.ko *.so *.o *.tmp *.ver *.order
the flags that I use do not violate the rtapi rules? Will this affect the operation of Linux cnc? Is it redundant and unnecessary?
MODULE_NAME := Name
MODINC := /usr/share/linuxcnc/Makefile.modinc
SRC_DIR := Src
INC_DIR := Inc
SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES := $(notdir $(SRC_FILES:.c=.o))
$(MODULE_NAME)-objs := $(OBJ_FILES)
obj-m += $(MODULE_NAME).o
export BUILD_VERBOSE := 1
include $(MODINC)
EXTRA_CFLAGS += -I$(shell pwd)/$(SRC_DIR)
EXTRA_CFLAGS += -I$(shell pwd)/$(INC_DIR)
EXTRA_CFLAGS += -O2
EXTRA_CFLAGS += -march=x86-64
EXTRA_CFLAGS += -mtune=generic
EXTRA_CFLAGS += -fno-fast-math
EXTRA_CFLAGS += -fno-unsafe-math-optimizations
%.o: $(SRC_DIR)/%.c
$(CC) $(EXTRA_CFLAGS) -c $< -o $@
all:
make -S modules
clean:
rm -f *.ko *.so *.o *.tmp *.ver *.order
the flags that I use do not violate the rtapi rules? Will this affect the operation of Linux cnc? Is it redundant and unnecessary?
Please Log in or Create an account to join the conversation.
Time to create page: 0.172 seconds