Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / Common / Makefile.common.in
blob7016cf1fb4177c114d4a7abcb17d7fa582be8b6e
2 #  Makefile.common.in: Can be included by drivers to simplify
3 #  driver development.
7 # Autoconfig stuff
8 ########################################
10 @SET_MAKE@
12 top_srcdir      = @top_srcdir@
13 common_srcdir   = ${top_srcdir}/Drivers/Common
14 PREFIX          = @prefix@
15 DISTDIR         = @DISTDIR@
16 DRIVERDIR       = ${DISTDIR}/User/Devs/AHI
17 MODEFILEDIR     = ${DISTDIR}/User/Devs/AudioModes
19 VPATH           += ${common_srcdir}
21 host            = @host@
23 CC              = @CC@
24 AS              = @AS@
25 AR              = @AR@
26 RANLIB          = @RANLIB@
27 STRIP           = @STRIP@ @STRIPFLAGS@
28 OBJCOPY         = @OBJCOPY@
30 CPPFLAGS        = @CPPFLAGS@ -I${top_srcdir} -I${common_srcdir} -I${srcdir} \
31                   -DDRIVER="\"${DRIVER}\""
32 CFLAGS          = @CFLAGS@
33 ASFLAGS         = @ASFLAGS@
34 LDFLAGS         = @LDFLAGS@ -nostartfiles
35 ifeq (@host_os@,aros)
36 LDFLAGS         += -static
37 endif
38 ARFLAGS         = @ARFLAGS@
40 SFDC            = @SFDC@
42 # Do not link drivers with any library by default
43 LIBS            += 
45 ifeq ($(DEST),)
46   DEST := Devs
47 endif
49 ifeq ($(MODEDEST),)
50   MODEDEST := $(DEST)
51 endif
53 INSTALL         = @INSTALL@
54 INSTALL_PROGRAM = @INSTALL_PROGRAM@
55 INSTALL_DATA    = @INSTALL_DATA@
58 # Files
59 ########################################
61 DRIVER_OBJECTS  = library.o gatestubs.o $(OBJECTS)
65 # Targets
66 ########################################
68 .PHONY:         all mostlyclean clean distclean maintainer-clean\
69                 install revup bindist bindist-install
72 all:            $(DRIVER) $(MODEFILE)
74 mostlyclean:
75         $(RM) $(DRIVER) $(MODEFILE) *.o *.a Makefile.dep
77 clean:          mostlyclean
78         $(RM) version.h gatestubs.c gatestubs.h
80 distclean:      clean
81         $(RM) Makefile
83 maintainer-clean: distclean
85 install:        all
86         $(INSTALL) -d $(PREFIX)/$(DEST)/AHI $(PREFIX)/$(MODEDEST)/AudioModes
87         $(INSTALL_PROGRAM) $(DRIVER) $(PREFIX)/$(DEST)/AHI/
88         $(INSTALL_DATA) $(MODEFILE) $(PREFIX)/$(MODEDEST)/AudioModes/
90 revup:
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
96 bindist:        all
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)
113 # Rules
114 ########################################
116 %.o:    %.s
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
151         @echo Creating $@
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)\"" >> $@
161 # Dependencies
162 ########################################
164 SOURCES         = $(wildcard $(common_srcdir)/*.c) $(wildcard $(srcdir)/*.c) 
165 HEADERS         = $(wildcard $(common_srcdir)/*.h) $(wildcard $(srcdir)/*.h)
167 #DEPENDENCIES   = $(SOURCES) $(HEADERS)
169 .PHONY: depend
171 depend:
172         $(RM) Makefile.dep
173         $(MAKE) Makefile.dep
175 Makefile.dep:   $(DEPENDENCIES) version.h \
176                 gatestubs.c gatestubs.h
177         @echo Making $@
178         -@$(CC) $(CPPFLAGS) $(CFLAGS) -MM $(SOURCES) > $@
180 include Makefile.dep