summaryrefslogtreecommitdiff
path: root/src/hal/utils/Submakefile
blob: 368e5615040564e6b9897741d99126ea6a428c0c (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
HALCMDSRCS := hal/utils/halcmd.c hal/utils/halcmd_commands.c hal/utils/halcmd_main.c
HALSHSRCS := hal/utils/halcmd.c hal/utils/halcmd_commands.c hal/utils/halsh.c

ifneq ($(READLINE_LIBS),)
HALCMDSRCS += hal/utils/halcmd_completion.c
endif
USERSRCS += $(sort $(HALCMDSRCS) $(HALSHSRCS))

$(call TOOBJSDEPS, $(HALSHSRCS)) : EXTRAFLAGS = -fPIC
$(call TOOBJSDEPS, hal/utils/halsh.c) : EXTRAFLAGS += $(TCL_CFLAGS)
../tcl/hal.so: $(call TOOBJS, $(HALSHSRCS)) ../lib/liblinuxcncini.so.0 ../lib/liblinuxcnchal.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -shared $^  $(TCL_LIBS) -o $@
TARGETS += ../tcl/hal.so

../bin/halcmd: $(call TOOBJS, $(HALCMDSRCS)) ../lib/liblinuxcncini.so.0 ../lib/liblinuxcnchal.so.0 
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(READLINE_LIBS)
TARGETS += ../bin/halcmd

HALRMTSRCS := hal/utils/halrmt.c
USERSRCS += $(HALRMTSRCS)

../bin/halrmt: $(call TOOBJS, $(HALRMTSRCS)) ../lib/liblinuxcnchal.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ -lpthread
TARGETS += ../bin/halrmt

ifneq ($(GTK_VERSION),)
HALMETERSRCS := \
    hal/utils/meter.c \
    hal/utils/miscgtk.c

USERSRCS += $(HALMETERSRCS)

../bin/halmeter: $(call TOOBJS, $(HALMETERSRCS)) ../lib/liblinuxcnchal.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^  $(GTK_LIBS)
TARGETS += ../bin/halmeter

HALSCOPESRCS := \
    hal/utils/scope.c \
    hal/utils/scope_horiz.c \
    hal/utils/scope_vert.c \
    hal/utils/scope_trig.c \
    hal/utils/scope_disp.c \
    hal/utils/scope_files.c \
    hal/utils/miscgtk.c

USERSRCS += $(HALSCOPESRCS)

../bin/halscope: $(call TOOBJS, $(HALSCOPESRCS)) ../lib/liblinuxcnchal.so.0
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(GTK_LIBS) -lm
TARGETS += ../bin/halscope

HALGTKSRCS := \
    hal/utils/scope.c \
    hal/utils/scope_horiz.c \
    hal/utils/scope_vert.c \
    hal/utils/scope_trig.c \
    hal/utils/scope_disp.c \
    hal/utils/scope_files.c \
    hal/utils/meter.c \
    hal/utils/miscgtk.c
$(call TOOBJSDEPS, $(HALGTKSRCS)) : EXTRAFLAGS = $(GTK_CFLAGS)
$(call TOOBJS, $(HALGTKSRCS)): Makefile.inc
endif

ifneq ($(BUILD_SYS),sim)
PCIWRITESRCS := hal/utils/pci_write.c hal/utils/upci.c
USERSRCS += $(PCIWRITESRCS)
../bin/pci_write: $(call TOOBJS, $(PCIWRITESRCS))
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^
TARGETS += ../bin/pci_write

PCIREADSRCS := hal/utils/pci_read.c hal/utils/upci.c
USERSRCS += $(PCIREADSRCS)
../bin/pci_read: $(call TOOBJS, $(PCIREADSRCS))
	$(ECHO) Linking $(notdir $@)
	$(Q)$(CC) $(LDFLAGS) -o $@ $^
TARGETS += ../bin/pci_read

endif

../bin/comp: ../bin/%: objects/hal/utils/%.py
	@$(ECHO) Syntax checking python script $(notdir $@)
	$(Q)$(PYTHON) -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' $<
	$(ECHO) Copying python script $(notdir $@)
	$(Q)(echo '#!$(PYTHON)'; sed '1 { /^#!/d; }' $<) > $@.tmp && chmod +x $@.tmp && mv -f $@.tmp $@

../bin/yapps: ../bin/%: hal/utils/%.py
	@$(ECHO) Syntax checking python script $(notdir $@)
	$(Q)$(PYTHON) -c 'import sys; compile(open(sys.argv[1]).read(), sys.argv[1], "exec")' $<
	$(ECHO) Copying python script $(notdir $@)
	$(Q)(echo '#!$(PYTHON)'; sed '1 { /^#!/d; }' $<) > $@.tmp && chmod +x $@.tmp && mv -f $@.tmp $@

TARGETS += ../bin/comp
objects/%.py: %.g ../bin/yapps
	@mkdir -p $(dir $@)
	$(Q)../bin/yapps $< $@