214 lines
5.1 KiB
Makefile
214 lines
5.1 KiB
Makefile
# Makefile.in
|
|
#
|
|
# This file is part of a free library building Windows NT drivers.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
# start config section
|
|
|
|
SHELL = @SHELL@
|
|
|
|
srcdir = @srcdir@
|
|
VPATH = @srcdir@
|
|
|
|
host_alias = @host@
|
|
build_alias = @build@
|
|
target_alias = @target@
|
|
with_cross_host = @with_cross_host@
|
|
prefix = @prefix@
|
|
includedir:=@includedir@
|
|
|
|
program_transform_name = @program_transform_name@
|
|
exec_prefix = @exec_prefix@
|
|
libdir:=@libdir@
|
|
bindir = @bindir@
|
|
ifeq ($(target_alias),$(host_alias))
|
|
ifeq ($(build_alias),$(host_alias))
|
|
tooldir:=$(exec_prefix)
|
|
else
|
|
tooldir:=$(exec_prefix)/$(target_alias)
|
|
endif
|
|
else
|
|
tooldir:=$(exec_prefix)/$(target_alias)
|
|
endif
|
|
datadir = @datadir@
|
|
infodir = @infodir@
|
|
ifneq (,$(findstring cygwin,$(target_alias)))
|
|
inst_includedir:=$(tooldir)/include/w32api/ddk
|
|
inst_libdir:=$(tooldir)/lib/w32api
|
|
else
|
|
ifneq (,$(with_cross_host))
|
|
inst_includedir:=$(tooldir)/include/w32api/ddk
|
|
inst_libdir:=$(tooldir)/lib
|
|
else
|
|
inst_includedir:=$(includedir)/ddk
|
|
inst_libdir:=$(libdir)
|
|
endif
|
|
endif
|
|
|
|
INSTALL = @INSTALL@
|
|
INSTALL_DATA = @INSTALL_DATA@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
mkinstalldirs = mkdir -p
|
|
|
|
CC = @CC@
|
|
CC_FOR_TARGET = $(CC)
|
|
|
|
DLLTOOL = @DLLTOOL@
|
|
DLLTOOL_FLAGS = --as=$(AS) -k
|
|
AS = @AS@
|
|
AS_FOR_TARGET = $(AS_FOR_TARGET)
|
|
WINDRES = @WINDRES@
|
|
|
|
# Depending on if we build as part of winsup or mingw we need to
|
|
# add additional include paths in order to get the correct headers
|
|
# from the C library.
|
|
BUILDENV = @BUILDENV@
|
|
|
|
ifeq ($(BUILDENV), cygwin)
|
|
# winsup/include
|
|
# winsup/../newlib/libc/include
|
|
# winsup/../newlib/libc/sys/cygwin
|
|
EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
|
|
endif
|
|
ifeq ($(BUILDENV), mingw)
|
|
EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
|
|
endif
|
|
|
|
INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
|
|
|
|
CFLAGS = @CFLAGS@
|
|
ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
|
|
|
|
RANLIB = @RANLIB@
|
|
AR = @AR@
|
|
LD = @LD@
|
|
|
|
# end config section
|
|
|
|
# headers
|
|
|
|
HEADERS = $(notdir $(wildcard $(srcdir)/../../include/ddk/*.h))
|
|
|
|
# libraries
|
|
|
|
DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
|
|
IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
|
|
LIBS = $(IMPLIBS)
|
|
|
|
DISTFILES = Makefile.in $(DEF_FILES)
|
|
|
|
.NOTPARALLEL:
|
|
|
|
# targets
|
|
all: $(LIBS)
|
|
|
|
TEST_OPTIONS = $(ALL_CFLAGS) -Wall -pedantic -Wsystem-headers -c $(srcdir)/test.c -o test.o
|
|
.PHONY: test
|
|
test:
|
|
@echo "Testing ddk..."
|
|
@for lang in c c++ objective-c ; do \
|
|
echo "$$lang..."; \
|
|
$(CC) -x$$lang $(TEST_OPTIONS) ; \
|
|
echo "$$lang UNICODE..."; \
|
|
$(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
|
|
done
|
|
@echo "windres..."
|
|
@$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
|
|
@echo "windres UNICODE..."
|
|
@$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
|
|
@rm -f test.o
|
|
|
|
# make rules
|
|
|
|
.SUFFIXES: .c .o .def .a
|
|
|
|
.c.o:
|
|
$(CC) -c $(ALL_CFLAGS) -o $@ $<
|
|
|
|
lib%.a : %.def %.o
|
|
$(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
|
|
$(AR) r $@ $*.o
|
|
$(RANLIB) $@
|
|
|
|
lib%.a: %.def
|
|
$(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
|
|
|
|
lib%.a: %.o
|
|
$(AR) rc $@ $*.o
|
|
$(RANLIB) $@
|
|
|
|
need-DESTDIR-compatibility = prefix libdir includedir
|
|
.PHONY: $(need-DESTDIR-compatibility) fail-DESTDIR-compatibility
|
|
|
|
$(need-DESTDIR-compatibility):
|
|
@test -z "$(DESTDIR)" || case "$($@)" in ?:*) \
|
|
$(MAKE) --no-print-directory reject="$@" fail-DESTDIR-compatibility ;; \
|
|
esac
|
|
|
|
fail-DESTDIR-compatibility:
|
|
$(error DESTDIR is not supported when $(reject) contains Win32 path `$($(reject))'; \
|
|
try `make install $(reject)=$(shell echo '$($(reject))' | sed s,:,:$(DESTDIR),) ...' instead)
|
|
|
|
# install headers and libraries in a target specified directory.
|
|
install: install-libraries install-headers
|
|
|
|
install-libraries: all $(need-DESTDIR-compatibility)
|
|
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)
|
|
for i in $(LIBS); do \
|
|
$(INSTALL_DATA) $$i $(DESTDIR)$(inst_libdir)/$$i ; \
|
|
done
|
|
|
|
install-headers: $(need-DESTDIR-compatibility)
|
|
$(mkinstalldirs) $(DESTDIR)$(inst_includedir)
|
|
for i in $(HEADERS); do \
|
|
$(INSTALL_DATA) $(srcdir)/../../include/ddk/$$i $(DESTDIR)$(inst_includedir)/$$i ; \
|
|
done
|
|
|
|
# uninstall headers and libraries from a target specified directory
|
|
uninstall: uninstall-libraries uninstall-headers
|
|
|
|
uninstall-libraries: $(need-DESTDIR-compatibility)
|
|
@for i in $(LIBS); do \
|
|
rm -f $(DESTDIR)$(inst_libdir)/$$i ; \
|
|
done
|
|
rmdir $(DESTDIR)$(inst_libdir)
|
|
|
|
uninstall-headers: $(need-DESTDIR-compatibility)
|
|
@for i in $(HEADERS); do \
|
|
rm -r $(DESTDIR)$(inst_includedir)/$$i ; \
|
|
done
|
|
rmdir $(DESTDIR)$(inst_includedir)
|
|
|
|
|
|
dist:
|
|
mkdir $(distdir)/include/ddk
|
|
chmod 755 $(distdir)/include/ddk
|
|
@for i in $(HEADERS); do \
|
|
cp -p $(srcdir)/../../include/ddk/$$i $(distdir)/include/ddk/$$i ; \
|
|
done
|
|
mkdir $(distdir)/lib/ddk
|
|
chmod 755 $(distdir)/lib/ddk
|
|
@for i in $(DISTFILES); do \
|
|
cp -p $(srcdir)/$$i $(distdir)/lib/ddk/$$i ; \
|
|
done
|
|
|
|
Makefile: Makefile.in ../../config.status ../../configure
|
|
cd ../..; $(SHELL) config.status
|
|
|
|
# clean
|
|
|
|
mostlyclean:
|
|
rm -f *~ *.o *.s
|
|
|
|
clean:
|
|
rm -f *.o *.a *.s *~
|
|
|
|
distclean: clean
|
|
rm -f config.cache config.status config.log Makefile
|
|
|
|
maintainer-clean: distclean
|