summaryrefslogtreecommitdiff
path: root/kernel/GNUmakefile
blob: 3ec8aa6d7d1b75175579402d85ddba53bbf75d8a (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#
# Zaptel kernel 2.4 makefile
#
# Copyright (C) 2008 Digium, Inc.
#

CFLAGS+=-DSTANDALONE_ZAPATA

ifeq ($(MAKELEVEL),0)
PWD:=$(shell pwd)
endif

KINCLUDES:=$(KSRC)/include

BUILDVER:=linux24

HOTPLUG_FIRMWARE:=no

ifeq ($(HOTPLUG_FIRMWARE),yes)
  CFLAGS+=-DHOTPLUG_FIRMWARE
endif

ifeq ($(ARCH),i386)
ifneq ($(wildcard $(PWD)/hpec/hpec_x86_32.o_shipped),)
HPEC_PRESENT=yes
endif
endif

ifeq ($(ARCH),x86_64)
ifneq ($(wildcard $(PWD)/hpec/hpec_x86_64.o_shipped),)
HPEC_PRESENT=yes
endif
endif

BUILD_MODULES:=$(BUILD_TOPDIR_MODULES) $(BUILD_SUBDIR_MODULES)
ALL_MODULES	:= $(BUILD_TOPDIR_MODULES:%=%.o) \
	$(join $(BUILD_SUBDIR_MODULES:%=%/), $(BUILD_SUBDIR_MODULES:%=%.o))

OPTFLAG=-O2
CFLAGS+=-I. $(OPTFLAGS) -g -fPIC -Wall -DBUILDING_TONEZONE #-DTONEZONE_DRIVER
ifneq (,$(findstring ppc,$(UNAME_M)))
CFLAGS_PPC:=-fsigned-char
endif
ifneq (,$(findstring x86_64,$(UNAME_M)))
CFLAGS_x86_64:=-m64
endif
CFLAGS+=$(CFLAGS_PPC) $(CFLAGS_x86_64)
KFLAGS=-I$(KINCLUDES) -O6
KFLAGS+=-DMODULE -D__KERNEL__ -DEXPORT_SYMTAB -I$(KSRC)/drivers/net \
	-Wall -I. -Wstrict-prototypes -fomit-frame-pointer -I$(KSRC)/drivers/net/wan -I$(KINCLUDES)/net
ifneq (,$(wildcard $(KINCLUDES)/linux/modversions.h))
  KFLAGS+=-DMODVERSIONS -include $(KINCLUDES)/linux/modversions.h
endif
ifneq (,$(findstring ppc,$(UNAME_M)))
KFLAGS_PPC:=-msoft-float -fsigned-char
endif
KFLAGS+=$(KFLAGS_PPC)
  ifneq (,$(findstring x86_64,$(UNAME_M)))
    KFLAGS+=-mcmodel=kernel
  endif

#
# Features are now configured in zconfig.h
#

MODULE_ALIASES=wcfxs wctdm8xxp wct2xxp

KFLAGS+=-DSTANDALONE_ZAPATA

MOD_DIR:=$(DESTDIR)/lib/modules/$(KVERS)/misc

all: modules

ifeq ($(HPEC_PRESENT),yes)
ifeq ($(ARCH),i386)
ZAPTEL_HPEC:=hpec/hpec_x86_32.o_shipped
endif

ifeq ($(ARCH),x86_64)
ZAPTEL_HPEC:=hpec/hpec_x86_64.o_shipped
endif

KFLAGS+=-DECHO_CAN_HPEC -I$(PWD)/hpec
zaptel-base.o: hpec/hpec_zaptel.h hpec/hpec_user.h
endif

prereq: tor2fw.h radfw.h version.h

tor2fw.h: tormenta2.rbt makefw 
	./makefw $< tor2fw > $@

radfw.h: pciradio.rbt makefw
	./makefw $< radfw > $@

makefw: makefw.c
	$(HOSTCC) -o $@ $^
			

modules: $(ALL_MODULES)

wct4xxp/wct4xxp.o:
	$(MAKE) -C wct4xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."

tor2.o: tor2-hw.h tor2fw.h

zaptel-base.o: digits.h arith.h sec.h sec-2.h kb1ec.h mg2ec.h zconfig.h

wcusb.o: wcusb.h

wctdm.o: wctdm.h

wctdm24xxp/wctdm24xxp.o:
	$(MAKE) -C wctdm24xxp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."

wcte12xp/wcte12xp.o:
	$(MAKE) -C wcte12xp KFLAGS="$(KFLAGS) -I.." CFLAGS="$(CFLAGS) -I.."

pciradio.o: radfw.h

ztdummy.o: ztdummy.h

zaptel.o: zaptel-base.o $(ZAPTEL_HPEC)
	$(LD) -r -o $@ $< $(ZAPTEL_HPEC)

$(filter-out zaptel.o,$(BUILD_TOPDIR_MODULES:%=%.o)) zaptel-base.o: %.o: %.c zaptel.h
	$(CC) $(KFLAGS) -o $@ -c $<

install: all devices install-modules install-programs install-firmware
	@echo "###################################################"
	@echo "###"
	@echo "### Zaptel installed successfully."
	@echo "### If you have not done so before, install init scripts with:"
	@echo "###"
	@echo "###   make config"
	@echo "###"
	@echo "###################################################"

BASENAMES=$(sort $(shell for x in $(ALL_MODULES); do basename $x; done))
uninstall-modules:

BASENAMES=$(sort $(shell for mod in $(ALL_MODULES); do basename $$mod; done))

install-modules: $(INSTALL_MODULES) uninstall-modules
	$(INSTALL) -d $(DESTDIR)$(MOD_DIR)
	$(INSTALL) -m 644 $(INSTALL_MODULES) $(DESTDIR)$(MOD_DIR)
	[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :

clean:
	rm -f makefw tor2fw.h radfw.h
	rm -f *.o 
	$(MAKE) -C wct4xxp clean
	rm -rf .tmp_versions
	rm -f core

distclean: dist-clean

dist-clean: clean

.PHONY: menuselect distclean dist-clean clean all _all install modules config install-modules uninstall-modules