Mac OS X Support : Makefile modification to support darwin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
Here are the modifications I made to the makefile in order to support Mac OS X. Here is a little explanation on the modifications I made:
First of all, Mac OS X has a special way to handle loadable binary code. It uses Mach-O file format which has differences with the elf file format, there is no Elf Shared Object-like system: Code is dynamically loadable or dynamically linkable, but not both at the same time. So you produce dynamic loadable library (dylib) or dynamic loadable code (bundle) but not both at the same time. For example ntdll must be built as a dynamic library as it is referenced at compilation time as a library.
There are also issue with undefined symbols, common defined symbol and name space, and an other with strip.


Thanks,

Pierre

Modified files : Make.rules.in, dlls/Makedll.rules.in, dlls/Makefile.in, ntdll/Makefile.in, libs/unicode/Makefile.in, libs/uuid/Makefile.in, libs/wine/Makefile.in

ChangeLog:
Support for Mac OS X's Mach-O and build system.
Index: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.156
diff -u -r1.156 Make.rules.in
--- Make.rules.in	1 May 2003 03:16:21 -0000	1.156
+++ Make.rules.in	3 May 2003 18:40:41 -0000
@@ -34,11 +34,13 @@
 DLLEXT    = @DLLEXT@
 IMPLIBEXT = @IMPLIBEXT@
 LDSHARED  = @LDSHARED@
+LDDYLIB   = @LDDYLIB@
 DLLTOOL   = @DLLTOOL@
 DLLWRAP   = @DLLWRAP@
 AR        = @AR@ rc
 RANLIB    = @RANLIB@
 STRIP     = @STRIP@
+STRIPFLAG = @STRIPFLAG@
 WINDRES   = @WINDRES@
 LN        = @LN@
 LN_S      = @LN_S@
Index: dlls/Makedll.rules.in
===================================================================
RCS file: /home/wine/wine/dlls/Makedll.rules.in,v
retrieving revision 1.55
diff -u -r1.55 Makedll.rules.in
--- dlls/Makedll.rules.in	21 Apr 2003 23:54:06 -0000	1.55
+++ dlls/Makedll.rules.in	3 May 2003 18:41:40 -0000
@@ -18,7 +18,7 @@
 ALL_LIBS    = $(LIBWINE) $(EXTRALIBS) $(LIBPORT) $(LIBS)
 IMPORTLIBS  = $(DELAYIMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT)) $(IMPORTS:%=$(DLLDIR)/lib%.$(IMPLIBEXT))
 
-all: $(MODULE)$(DLLEXT) $(SUBDIRS)
+all: $(EXTRADEP) $(MODULE)$(DLLEXT) $(SUBDIRS)
 
 @MAKE_RULES@
 
@@ -32,7 +32,11 @@
 
 $(MODULE).tmp.o: $(ALL_OBJS) Makefile.in
 	$(LDCOMBINE) $(ALL_OBJS) -o $@
-	-$(STRIP) --strip-unneeded $@
+	-$(STRIP) $(STRIPFLAG) $@
+
+# Rule for .dylib files
+$(MODULE).dylib: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
+	$(LDDYLIB) -single_module -flat_namespace -undefined suppress $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc
 
 # Rule for 16-bit glue
 
Index: dlls/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/Makefile.in,v
retrieving revision 1.173
diff -u -r1.173 Makefile.in
--- dlls/Makefile.in	12 Apr 2003 00:05:27 -0000	1.173
+++ dlls/Makefile.in	3 May 2003 18:41:45 -0000
@@ -1551,15 +1551,25 @@
 
 LINKABLE_DLLS = ntdll.dll
 
-libntdll.dll.$(LIBEXT): ntdll/ntdll.dll$(DLLEXT)
+ntdll/ntdll.dll.dylib:
+        
+
+libntdll.dll.so: ntdll/ntdll.dll$(DLLEXT)
+	$(RM) $@ && $(LN_S) ntdll/ntdll.dll$(DLLEXT) $@
+
+libntdll.dll.a: ntdll/ntdll.dll$(DLLEXT)
 	$(RM) $@ && $(LN_S) ntdll/ntdll.dll$(DLLEXT) $@
 
+libntdll.dll.dylib: ntdll/ntdll.dll.dylib
+	$(RM) $@ && $(LN_S) ntdll/ntdll.dll.dylib $@
+
 kernel: libntdll.dll.$(LIBEXT)
 
 uninstall::
 	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+.PHONY: install-lib-so install-lib-a install-lib-dylib
 
-install install-lib:: $(INSTALLSUBDIRS:%=%/__install__)
+install-lib-so:
 	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
 	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
 	then \
@@ -1567,6 +1577,26 @@
 	else \
 	  $(LN_S) $(dlldir)/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
 	fi
+
+install-lib-a:
+	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
+	then \
+	  $(LN_S) wine/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
+	else \
+	  $(LN_S) $(dlldir)/ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT); \
+	fi
+
+install-lib-dylib:
+	$(RM) $(LINKABLE_DLLS:%=$(libdir)/lib%.$(LIBEXT))
+	cd $(libdir) && if [ "$(dlldir)" = "$(libdir)/wine" ]; \
+	then \
+	  $(LN_S) wine/ntdll.dll.$(LIBEXT) libntdll.dll.$(LIBEXT); \
+	else \
+	  $(LN_S) $(dlldir)/ntdll.dll.$(LIBEXT) libntdll.dll.$(LIBEXT); \
+	fi
+
+install install-lib:: $(INSTALLSUBDIRS:%=%/__install__) $(LIBEXT:%=install-lib-%)
 
 # Rules for auto documentation
 
Index: dlls/ntdll/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/Makefile.in,v
retrieving revision 1.59
diff -u -r1.59 Makefile.in
--- dlls/ntdll/Makefile.in	30 Apr 2003 00:53:23 -0000	1.59
+++ dlls/ntdll/Makefile.in	3 May 2003 18:41:50 -0000
@@ -5,6 +5,7 @@
 VPATH     = @srcdir@
 MODULE    = ntdll.dll
 EXTRALIBS = $(LIBUNICODE) @LIBPTHREAD@
+EXTRADEP  = @NTDLLEXTRADEP@
 
 C_SRCS = \
 	$(TOPOBJDIR)/files/directory.c \
Index: libs/unicode/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/unicode/Makefile.in,v
retrieving revision 1.4
diff -u -r1.4 Makefile.in
--- libs/unicode/Makefile.in	1 May 2003 00:39:29 -0000	1.4
+++ libs/unicode/Makefile.in	3 May 2003 18:42:09 -0000
@@ -1,3 +1,7 @@
+<<<<<<< Makefile.in
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__ -DNO_LIBWINE_PORT
+=======
+>>>>>>> 1.4
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
@@ -79,6 +83,65 @@
 	wctype.c \
 	$(CODEPAGES:%=c_%.c)
 
+<<<<<<< Makefile.in
+all: $(MODULE) $(MODULE:.dll=.a)
+
+@MAKE_RULES@
+
+libwine_unicode.$(SOVERSION).dylib: $(OBJS) Makefile.in
+	$(LDDYLIB) $(OBJS) -o $@
+
+libwine_unicode.dylib: libwine_unicode.$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) libwine_unicode.$(SOVERSION).dylib $@
+
+libwine_unicode.so.$(SOVERSION): $(OBJS) Makefile.in
+	$(LDSHARED) $(OBJS) -o $@
+
+libwine_unicode.so: libwine_unicode.so.$(SOVERSION)
+	$(RM) $@ && $(LN_S) libwine_unicode.so.$(SOVERSION) $@
+
+libwine_unicode.a: wine_unicode.def
+	$(DLLTOOL) -l $@ -d $(SRCDIR)/wine_unicode.def
+
+libwine_unicode.dll: $(OBJS) wine_unicode.def Makefile.in
+	$(DLLWRAP) --def $(SRCDIR)/wine_unicode.def -o $@ $(OBJS)
+
+.PHONY: install-lib-dylib install-lib-so install-lib-dll install-dev-so install-dev-dll
+
+install-lib-dylib: libwine_unicode.$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine_unicode.$(SOVERSION).dylib $(libdir)/libwine_unicode.$(SOVERSION).dylib
+
+install-lib-so: libwine_unicode.so.$(SOVERSION) dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.so.$(SOVERSION)
+
+install-lib-dll: libwine_unicode.dll dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine_unicode.dll $(libdir)/libwine_unicode.dll
+
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine_unicode.dylib && $(LN_S) libwine_unicode.$(SOVERSION).dylib libwine_unicode.dylib
+
+install-dev-so: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine_unicode.so && $(LN_S) libwine_unicode.so.$(SOVERSION) libwine_unicode.so
+
+install-dev-dll: libwine_unicode.a dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine_unicode.a $(libdir)/libwine_unicode.a
+
+install install-lib:: $(LIBEXT:%=install-lib-%)
+install install-dev:: $(LIBEXT:%=install-dev-%)
+
+uninstall::
+	$(RM) $(libdir)/libwine_unicode.a $(libdir)/libwine_unicode.dll $(libdir)/libwine_unicode.so $(libdir)/libwine_unicode.so.$(SOVERSION) $(libdir)/libwine_unicode.dylib $(libdir)/libwine_unicode.$(SOVERSION).dylib
+
+clean::
+	$(RM) libwine_unicode.so.$(SOVERSION) libwine_unicode.dll libwine_unicode.$(SOVERSION).dylib
+=======
 @MAKE_LIB_RULES@
+>>>>>>> 1.4
 
 ### Dependencies:
Index: libs/uuid/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/uuid/Makefile.in,v
retrieving revision 1.2
diff -u -r1.2 Makefile.in
--- libs/uuid/Makefile.in	22 Mar 2003 20:40:48 -0000	1.2
+++ libs/uuid/Makefile.in	3 May 2003 18:42:10 -0000
@@ -1,4 +1,4 @@
-DEFS      = @DLLFLAGS@ -D__WINESRC__
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
Index: libs/wine/Makefile.in
===================================================================
RCS file: /home/wine/wine/libs/wine/Makefile.in,v
retrieving revision 1.3
diff -u -r1.3 Makefile.in
--- libs/wine/Makefile.in	1 May 2003 00:39:29 -0000	1.3
+++ libs/wine/Makefile.in	3 May 2003 18:42:10 -0000
@@ -1,3 +1,7 @@
+<<<<<<< Makefile.in
+DEFS      = @LIBCFLAGS@ @DLLFLAGS@ -D__WINESRC__ -DDLLDIR="\"$(dlldir)\""
+=======
+>>>>>>> 1.3
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ../..
 SRCDIR    = @srcdir@
@@ -14,6 +18,65 @@
 	ldt.c \
 	loader.c
 
+<<<<<<< Makefile.in
+all: $(MODULE) $(MODULE:.dll=.a)
+
+@MAKE_RULES@
+
+libwine.$(SOVERSION).dylib: $(OBJS)
+	$(LDDYLIB) $(OBJS) $(EXTRALIBS) $(LIBS) -o $@
+        
+libwine.dylib: libwine.$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) libwine.$(SOVERSION).dylib $@
+
+libwine.so.$(SOVERSION): $(OBJS) Makefile.in
+	$(LDSHARED) $(OBJS) $(EXTRALIBS) $(LIBS) -o $@
+
+libwine.so: libwine.so.$(SOVERSION)
+	$(RM) $@ && $(LN_S) libwine.so.$(SOVERSION) $@
+
+libwine.a: wine.def
+	$(DLLTOOL) -l $@ -d $(SRCDIR)/wine.def
+
+libwine.dll: $(OBJS) wine.def Makefile.in
+	$(DLLWRAP) --def $(SRCDIR)/wine.def -o $@ $(OBJS) $(EXTRALIBS)
+
+.PHONY: install-lib-dylib install-lib-so install-lib-dll install-dev-so install-dev-dll
+
+install-lib-dylib: libwine.$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine.$(SOVERSION).dylib $(libdir)/libwine.$(SOVERSION).dylib
+
+install-lib-so: libwine.so.$(SOVERSION) dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) libwine.so.$(SOVERSION) $(libdir)/libwine.so.$(SOVERSION)
+
+install-lib-dll: libwine.dll dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine.dll $(libdir)/libwine.dll
+
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine.dylib && $(LN_S) libwine.$(SOVERSION).dylib libwine.dylib
+
+install-dev-so: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) libwine.so && $(LN_S) libwine.so.$(SOVERSION) libwine.so
+
+install-dev-dll: libwine.a dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_DATA) libwine.a $(libdir)/libwine.a
+
+install install-lib:: $(LIBEXT:%=install-lib-%)
+install install-dev:: $(LIBEXT:%=install-dev-%)
+
+uninstall::
+	$(RM) $(libdir)/libwine.a $(libdir)/libwine.dll $(libdir)/libwine.so $(libdir)/libwine.so.$(SOVERSION) $(libdir)/libwine.dylib $(libdir)/libwine.$(SOVERSION).dylib
+
+clean::
+	$(RM) libwine.so.$(SOVERSION) libwine.dll libwine.$(SOVERSION).dylib
+=======
 @MAKE_LIB_RULES@
+>>>>>>> 1.3
 
 ### Dependencies:

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux