-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
62 lines (28 loc) · 989 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# usage : $ make all
# usgae : $ make clean
COMP=/opt/linuxcnc/bin/halcompile
# include modinc
MODINC=$(shell $(COMP) --print-modinc)
ifeq (, $(MODINC))
$(error Unable to get modinc path)
endif
include $(MODINC)
# File list to compile
obj-m += opencascade.o
files-to-compile := \
opencascade.o \
cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
> /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
module = $(patsubst %.o,%.so,$(obj-m))
EXTRA_CFLAGS := $(filter-out -Wframe-larger-than=%,$(EXTRA_CFLAGS))
$(module): $(files-to-compile)
$(CC) -shared -o $@ $(files-to-compile) -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal -lrt -L/home/user/Desktop/Linux-Embedded/linux-hal/halcompile-opencascade/next -lnext
%.o: %.c
$(CC) -o $@ $(EXTRA_CFLAGS) -Os -c $<
all: $(module)
clean:
rm -f $(module)
rm -f *.so *.ko *.o
rm -f *.sym *.tmp *.ver
rm -f *.mod.c .*.cmd
rm -f modules.order Module.symvers