2 # Makefile.common.in: Can be included by drivers to simplify
8 ########################################
12 top_srcdir = @top_srcdir@
13 common_srcdir = ${top_srcdir}/Drivers/Common
16 DRIVERDIR = ${DISTDIR}/User/Devs/AHI
17 MODEFILEDIR = ${DISTDIR}/User/Devs/AudioModes
19 VPATH += ${common_srcdir}
27 STRIP = @STRIP@ @STRIPFLAGS@
30 CPPFLAGS = @CPPFLAGS@ -I${top_srcdir} -I${common_srcdir} -I${srcdir} \
31 -DDRIVER="\"${DRIVER}\""
34 LDFLAGS = @LDFLAGS@ -nostartfiles
42 # Do not link drivers with any library by default
54 INSTALL_PROGRAM = @INSTALL_PROGRAM@
55 INSTALL_DATA = @INSTALL_DATA@
59 ########################################
61 DRIVER_OBJECTS = library.o gatestubs.o $(OBJECTS)
66 ########################################
68 .PHONY: all mostlyclean clean distclean maintainer-clean\
69 install revup bindist bindist-install
72 all: $(DRIVER) $(MODEFILE)
75 $(RM) $(DRIVER) $(MODEFILE) *.o *.a Makefile.dep
78 $(RM) version.h gatestubs.c gatestubs.h
83 maintainer-clean: distclean
86 $(INSTALL) -d $(PREFIX)/$(DEST)/AHI $(PREFIX)/$(MODEDEST)/AudioModes
87 $(INSTALL_PROGRAM) $(DRIVER) $(PREFIX)/$(DEST)/AHI/
88 $(INSTALL_DATA) $(MODEFILE) $(PREFIX)/$(MODEDEST)/AudioModes/
91 @rev=`cat $(srcdir)/version.rev` && echo `expr $$rev + 1` > $(srcdir)/version.rev
92 @date +%d.%m.%y > $(srcdir)/version.date
93 @echo -n "New revision: "
94 @cat $(srcdir)/version.rev
97 $(INSTALL) -d $(DRIVERDIR) $(MODEFILEDIR)
99 $(INSTALL_PROGRAM) $(DRIVER) $(DRIVERDIR)/$(DRIVER)
100 $(STRIP) $(DRIVERDIR)/$(DRIVER)
101 $(INSTALL_DATA) $(MODEFILE) $(MODEFILEDIR)/
105 # Auto-remake autoconf stuff
106 ########################################
108 Makefile: Makefile.in Makefile.common.in ../../config.status
109 (cd ../.. && ./config.status)
114 ########################################
117 $(AS) $(ASFLAGS) $^ -o $@
119 $(DRIVER): $(DRIVER_OBJECTS)
120 $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
122 $(MODEFILE): $(MODEFILE).o
123 $(OBJCOPY) --output-target=binary $< $@
125 $(MODEFILE).o: MODEFILE.s $(MODEFILE).s
126 $(AS) $(ASFLAGS) $^ -o $@
128 gatestubs.c: $(top_srcdir)/Include/SFD/ahi_sub_lib.sfd
129 $(SFDC) --mode=gatestubs --gateprefix=gw --libprefix=_ --libarg=last \
130 --addvectors=library --target=$(host) $^ -o $@
132 gatestubs.h: $(top_srcdir)/Include/SFD/ahi_sub_lib.sfd
133 $(SFDC) --mode=gateproto --gateprefix=gw --libprefix=_ --libarg=last \
134 --addvectors=library --target=$(host) $^ -o $@
136 gatestubs.o: gatestubs.c
137 $(CC) $(CFLAGS) $(CPPFLAGS) -D__CLIB_TYPES__ -c $^ $(OUTPUT_OPTION)
139 camdstubs.c: camd_drv.sfd
140 $(SFDC) --mode=gatestubs --gateprefix=gw --libprefix=_ --libarg=last \
141 --target=$(host) $^ -o $@
143 camdstubs.h: camd_drv.sfd
144 $(SFDC) --mode=gateproto --gateprefix=gw --libprefix=_ --libarg=last \
145 --target=$(host) $^ -o $@
147 camdstubs.o: camdstubs.c
148 $(CC) $(CFLAGS) $(CPPFLAGS) -D__CLIB_TYPES__ -c $^ $(OUTPUT_OPTION)
150 version.h: version.rev version.date
152 @ver=`cat $(srcdir)/version.ver` \
153 rev=`cat $(srcdir)/version.rev` \
154 date=`cat $(srcdir)/version.date` && \
155 echo "#define VERSION $$ver" > $@ && \
156 echo "#define REVISION $$rev" >> $@ && \
157 echo "#define VERS \"$$ver.$$rev ($$date)\"" >> $@
162 ########################################
164 SOURCES = $(wildcard $(common_srcdir)/*.c) $(wildcard $(srcdir)/*.c)
165 HEADERS = $(wildcard $(common_srcdir)/*.h) $(wildcard $(srcdir)/*.h)
167 #DEPENDENCIES = $(SOURCES) $(HEADERS)
175 Makefile.dep: $(DEPENDENCIES) version.h \
176 gatestubs.c gatestubs.h
178 -@$(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SOURCES) > $@