home *** CD-ROM | disk | FTP | other *** search
/ Programming Win32 Under the API / ProgrammingWin32UnderTheApiPatVillani.iso / src / mingw-runtime-19991107 / w32api / lib / Makefile.in < prev    next >
Encoding:
Makefile  |  1999-08-02  |  4.0 KB  |  182 lines

  1. #
  2. #    Makefile.in
  3. #
  4. #    This file is part of a free library for the Win32 API.
  5. #    This library is distributed in the hope that it will be useful,
  6. #    but WITHOUT ANY WARANTY; without even the implied warranty of
  7. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8.  
  9.  
  10. # start config section
  11.  
  12. SHELL = @SHELL@
  13.  
  14. srcdir = @srcdir@
  15. VPATH = @srcdir@
  16.  
  17. target_alias = @target_alias@
  18. prefix = @prefix@
  19.  
  20. program_transform_name = @program_transform_name@
  21. exec_prefix = @exec_prefix@
  22. bindir = @bindir@
  23. libdir = @libdir@
  24. tooldir = $(exec_prefix)/$(target_alias)
  25. datadir = @datadir@
  26. infodir = @infodir@
  27. includedir = @includedir@
  28.  
  29. INSTALL = @INSTALL@
  30. INSTALL_DATA = @INSTALL_DATA@
  31. INSTALL_PROGRAM = @INSTALL_PROGRAM@
  32. mkinstalldirs = mkdir -p
  33.  
  34. CC = @CC@
  35. CC_FOR_TARGET = $(CC)
  36.  
  37. DLLTOOL = @DLLTOOL@
  38. DLLTOOL_FLAGS = --as=$(AS) -k
  39. AS = @AS@
  40. AS_FOR_TARGET = $(AS_FOR_TARGET)
  41. WINDRES = @WINDRES@
  42.  
  43. # Depending on if we build as part of winsup or mingw we need to
  44. # add additional include paths in order to get the correct headers
  45. # from the C library.
  46. BUILDENV = @BUILDENV@
  47.  
  48. ifeq ($(BUILDENV), cygwin)
  49. # winsup/include
  50. # winsup/../newlib/libc/include
  51. # winsup/../newlib/libc/sys/cygwin
  52. EXTRA_INCLUDES = -I$(srcdir)/../../include -I$(srcdir)/../../../newlib/libc/include -I$(srcdir)/../../../newlib/libc/sys/cygwin
  53. endif
  54. ifeq ($(BUILDENV), mingw)
  55. EXTRA_INCLUDES = -I$(srcdir)/../../mingw/include
  56. endif
  57.  
  58. INCLUDES = -I$(srcdir)/../include $(EXTRA_INCLUDES)
  59.  
  60. CFLAGS = @CFLAGS@
  61. ALL_CFLAGS = $(CFLAGS) $(INCLUDES)
  62.  
  63. RANLIB = @RANLIB@
  64. AR = @AR@
  65. LD = @LD@
  66.  
  67. # end config section
  68.  
  69. # headers
  70.  
  71. HEADERS = $(notdir $(wildcard $(srcdir)/../include/*.h))
  72.  
  73. # libraries
  74.  
  75. DEF_FILES = $(notdir $(wildcard $(srcdir)/*.def))
  76. IMPLIBS = $(addprefix lib,$(subst .def,.a,$(DEF_FILES)))
  77. EXTRA_LIBS=libuuid.a libscrnsave.a libscrnsavw.a libdxguid.a liblargeint.a
  78. LIBS = $(IMPLIBS) $(EXTRA_LIBS)
  79. EXTRA_OBJS=uuid.o shell32.o dxguid.o scrnsave.o scrnsavw.o largeint.o $(UUID_OBJS)
  80. SOURCES = scrnsave.c shell32.c uuid.c largeint.c dinput.c dxguid.c \
  81. res.rc test.c
  82.  
  83. DISTFILES = Makefile.in $(DEF_FILES) $(SOURCES)
  84.  
  85. # targets
  86. all: $(LIBS) $(EXTRA_OBJS)
  87.  
  88. TEST_OPTIONS = $(ALL_CFLAGS) -Wall -c $(srcdir)/test.c -o test.o
  89. .PHONY: test
  90. test:
  91.     @echo "Testing w32api..."
  92.     @for lang in c c++ objective-c ; do \
  93.         echo "$$lang..."; \
  94.         $(CC) -x$$lang $(TEST_OPTIONS) ; \
  95.         echo "$$lang UNICODE..."; \
  96.         $(CC) -x$$lang -DUNICODE $(TEST_OPTIONS) ; \
  97.     done
  98.     @echo "windres..."
  99.     @$(WINDRES) --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
  100.     @echo "windres UNICODE..."
  101.     @$(WINDRES) --define UNICODE --include-dir $(INCDIR) -i $(srcdir)/res.rc -o test.o
  102.     @rm -f test.o
  103.  
  104. scrnsavw.o: scrnsave.c
  105.     $(CC) -c $(ALL_CFLAGS) -DUNICODE -o $@ $<
  106.  
  107. # make rules
  108.  
  109. .SUFFIXES: .c .o .def .a
  110.  
  111. .c.o:
  112.     $(CC) -c $(ALL_CFLAGS) -o $@ $<
  113.  
  114. lib%.a : %.def %.o
  115.     $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $(srcdir)/$*.def
  116.     $(AR) r $@ $*.o
  117.     $(RANLIB) $@
  118.  
  119. lib%.a: %.def
  120.     $(DLLTOOL) $(DLLTOOL_FLAGS) --output-lib $@ --def $<
  121.  
  122. lib%.a: %.o
  123.     $(AR) rc $@ $*.o
  124.     $(RANLIB) $@
  125.  
  126. # install headers and libraries
  127. install: install-libraries install-headers
  128.  
  129. install-libraries: all
  130.     $(mkinstalldirs) $(tooldir)/lib
  131.     for i in $(LIBS); do \
  132.         $(INSTALL_DATA) $$i $(tooldir)/lib/$$i ; \
  133.     done
  134.  
  135. install-headers:
  136.     $(mkinstalldirs) $(tooldir)/include
  137.     for i in $(HEADERS); do \
  138.         $(INSTALL_DATA) $(srcdir)/../include/$$i $(tooldir)/include/$$i ; \
  139.     done
  140.  
  141. # uninstall headers and libraries
  142. uninstall: uninstall-libraries uninstall-headers
  143.  
  144. uninstall-libraries:
  145.     @for i in $(LIBS); do \
  146.         rm -f $(tooldir)/lib/$$i ; \
  147.     done
  148.  
  149. uninstall-headers:
  150.     @for i in $(HEADERS); do \
  151.         rm -f $(tooldir)/include/$$i ; \
  152.     done
  153.  
  154. dist:
  155.     mkdir $(distdir)/include
  156.     chmod 755 $(distdir)/include
  157.     @for i in $(HEADERS); do \
  158.         cp -p $(srcdir)/../include/$$i $(distdir)/include/$$i ; \
  159.     done
  160.     mkdir $(distdir)/lib
  161.     chmod 755 $(distdir)/lib
  162.     @for i in $(DISTFILES); do \
  163.         cp -p $(srcdir)/$$i $(distdir)/lib/$$i ; \
  164.     done
  165.  
  166. Makefile: Makefile.in ../config.status ../configure
  167.     cd ..; $(SHELL) config.status
  168.  
  169. # clean
  170.  
  171. mostlyclean:
  172.     rm -f *~ *.o *.s
  173.  
  174. clean:
  175.     rm -f *.o *.a *.s *~
  176.  
  177. distclean: clean
  178.     rm -f config.cache config.status config.log Makefile
  179.  
  180. maintainer-clean: distclean
  181.