makefiles: Add separate variables for Unix flags and libraries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-06-29 11:06:16 +02:00
parent e2d96342df
commit 194e09baec
35 changed files with 64 additions and 59 deletions

View file

@ -2,7 +2,7 @@ MODULE = bcrypt.dll
IMPORTS = advapi32
IMPORTLIB = bcrypt
UNIXLIB = bcrypt.so
EXTRAINCL = $(GNUTLS_CFLAGS)
UNIX_CFLAGS = $(GNUTLS_CFLAGS)
C_SRCS = \
bcrypt_main.c \

View file

@ -1,8 +1,8 @@
MODULE = capi2032.dll
UNIXLIB = capi2032.so
IMPORTLIB = capi2032
EXTRALIBS = $(CAPI20_LIBS)
EXTRAINCL = $(CAPI20_CFLAGS)
UNIX_LIBS = $(CAPI20_LIBS)
UNIX_CFLAGS = $(CAPI20_CFLAGS)
C_SRCS = \
cap20wxx.c \

View file

@ -3,8 +3,8 @@ UNIXLIB = crypt32.so
IMPORTLIB = crypt32
IMPORTS = user32 advapi32 bcrypt
DELAYIMPORTS = cryptnet
EXTRALIBS = $(SECURITY_LIBS)
EXTRAINCL = $(GNUTLS_CFLAGS)
UNIX_LIBS = $(SECURITY_LIBS)
UNIX_CFLAGS = $(GNUTLS_CFLAGS)
C_SRCS = \
base64.c \

View file

@ -2,7 +2,7 @@ MODULE = dnsapi.dll
UNIXLIB = dnsapi.so
IMPORTLIB = dnsapi
DELAYIMPORTS = netapi32
EXTRALIBS = $(RESOLV_LIBS)
UNIX_LIBS = $(RESOLV_LIBS)
C_SRCS = \
libresolv.c \

View file

@ -2,7 +2,7 @@ MODULE = dwrite.dll
IMPORTLIB = dwrite
UNIXLIB = dwrite.so
IMPORTS = user32 gdi32 advapi32
EXTRAINCL = $(FREETYPE_CFLAGS)
UNIX_CFLAGS = $(FREETYPE_CFLAGS)
C_SRCS = \
analyzer.c \

View file

@ -1,8 +1,9 @@
MODULE = gphoto2.ds
UNIXLIB = gphoto2.so
IMPORTS = $(JPEG_PE_LIBS) comctl32 user32 gdi32 advapi32
EXTRALIBS = $(GPHOTO2_LIBS) $(GPHOTO2_PORT_LIBS)
EXTRAINCL = $(GPHOTO2_CFLAGS) $(GPHOTO2_PORT_CFLAGS) $(JPEG_PE_CFLAGS)
EXTRAINCL = $(JPEG_PE_CFLAGS)
UNIX_LIBS = $(GPHOTO2_LIBS) $(GPHOTO2_PORT_LIBS)
UNIX_CFLAGS = $(GPHOTO2_CFLAGS) $(GPHOTO2_PORT_CFLAGS)
C_SRCS = \
capability.c \

View file

@ -1,6 +1,6 @@
MODULE = kerberos.dll
UNIXLIB = kerberos.so
EXTRAINCL = $(KRB5_CFLAGS) $(GSSAPI_CFLAGS)
UNIX_CFLAGS = $(KRB5_CFLAGS) $(GSSAPI_CFLAGS)
C_SRCS = \
krb5_ap.c \

View file

@ -2,8 +2,8 @@ MODULE = mountmgr.sys
UNIXLIB = mountmgr.so
IMPORTS = uuid advapi32 ntoskrnl
DELAYIMPORTS = user32
EXTRAINCL = $(DBUS_CFLAGS) $(HAL_CFLAGS)
EXTRALIBS = $(DISKARBITRATION_LIBS) $(SYSTEMCONFIGURATION_LIBS) $(CORESERVICES_LIBS) $(SECURITY_LIBS)
UNIX_CFLAGS = $(DBUS_CFLAGS) $(HAL_CFLAGS)
UNIX_LIBS = $(DISKARBITRATION_LIBS) $(SYSTEMCONFIGURATION_LIBS) $(CORESERVICES_LIBS) $(SECURITY_LIBS)
EXTRADLLFLAGS = -Wl,--subsystem,native

View file

@ -1,7 +1,7 @@
MODULE = nsiproxy.sys
UNIXLIB = nsiproxy.so
IMPORTS = ntoskrnl
EXTRALIBS = $(PROCSTAT_LIBS)
UNIX_LIBS = $(PROCSTAT_LIBS)
EXTRADLLFLAGS = -Wl,--subsystem,native

View file

@ -3,8 +3,8 @@ MODULE = ntdll.dll
UNIXLIB = ntdll.so
IMPORTLIB = ntdll
IMPORTS = winecrt0
EXTRAINCL = $(UNWIND_CFLAGS)
EXTRALIBS = $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) $(PROCSTAT_LIBS)
UNIX_CFLAGS = $(UNWIND_CFLAGS)
UNIX_LIBS = $(IOKIT_LIBS) $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(RT_LIBS) $(PTHREAD_LIBS) $(UNWIND_LIBS) $(I386_LIBS) $(PROCSTAT_LIBS)
EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x7bc00000
x86_64_EXTRADLLFLAGS = -nodefaultlibs -Wl,--image-base,0x170000000

View file

@ -1,5 +1,5 @@
MODULE = openal32.dll
EXTRALIBS = $(OPENAL_LIBS)
UNIX_LIBS = $(OPENAL_LIBS)
EXTRADLLFLAGS = -Wb,--prefer-native -mcygwin

View file

@ -1,6 +1,6 @@
MODULE = opencl.dll
UNIXLIB = opencl.so
EXTRALIBS = $(OPENCL_LIBS)
UNIX_LIBS = $(OPENCL_LIBS)
C_SRCS = \
pe_thunks.c \

View file

@ -1,8 +1,8 @@
MODULE = sane.ds
UNIXLIB = sane.so
IMPORTS = comctl32 user32 gdi32
EXTRALIBS = $(SANE_LIBS)
EXTRAINCL = $(SANE_CFLAGS)
UNIX_LIBS = $(SANE_LIBS)
UNIX_CFLAGS = $(SANE_CFLAGS)
C_SRCS = \
capability.c \

View file

@ -3,7 +3,7 @@ IMPORTLIB = secur32
UNIXLIB = secur32.so
IMPORTS = advapi32
DELAYIMPORTS = crypt32
EXTRAINCL = $(GNUTLS_CFLAGS)
UNIX_CFLAGS = $(GNUTLS_CFLAGS)
C_SRCS = \
lsa.c \

View file

@ -2,9 +2,9 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = win32u.dll
UNIXLIB = win32u.so
IMPORTLIB = win32u
EXTRAINCL = $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS)
EXTRALIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS) -lm
IMPORTS = ntdll winecrt0
UNIX_CFLAGS = $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS)
UNIX_LIBS = $(CARBON_LIBS) $(APPKIT_LIBS) $(PTHREAD_LIBS) -lm
EXTRADLLFLAGS = -nodefaultlibs -Wb,--syscall-table,1

View file

@ -2,7 +2,7 @@ MODULE = winealsa.drv
UNIXLIB = winealsa.so
IMPORTS = uuid ole32 advapi32
DELAYIMPORTS = winmm
EXTRALIBS = $(ALSA_LIBS) $(PTHREAD_LIBS)
UNIX_LIBS = $(ALSA_LIBS) $(PTHREAD_LIBS)
C_SRCS = \
alsa.c \

View file

@ -2,7 +2,7 @@ EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = wineandroid.drv
UNIXLIB = wineandroid.so
IMPORTS = ntoskrnl
EXTRALIBS = -lwin32u $(PTHREAD_LIBS)
UNIX_LIBS = -lwin32u $(PTHREAD_LIBS)
C_SRCS = \
device.c \

View file

@ -1,8 +1,8 @@
MODULE = winebus.sys
UNIXLIB = winebus.so
IMPORTS = ntoskrnl hidparse
EXTRALIBS = $(IOKIT_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(INOTIFY_LIBS)
EXTRAINCL = $(UDEV_CFLAGS) $(SDL2_CFLAGS)
UNIX_LIBS = $(IOKIT_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(INOTIFY_LIBS)
UNIX_CFLAGS = $(UDEV_CFLAGS) $(SDL2_CFLAGS)
EXTRADLLFLAGS = -Wl,--subsystem,native

View file

@ -2,7 +2,7 @@ MODULE = winecoreaudio.drv
UNIXLIB = winecoreaudio.so
IMPORTS = uuid ole32 user32 advapi32
DELAYIMPORTS = winmm
EXTRALIBS = $(COREAUDIO_LIBS)
UNIX_LIBS = $(COREAUDIO_LIBS)
C_SRCS = \
coreaudio.c \

View file

@ -3,8 +3,8 @@ UNIXLIB = winegstreamer.so
IMPORTLIB = winegstreamer
IMPORTS = strmbase ole32 oleaut32 msdmo
DELAYIMPORTS = mfplat
EXTRAINCL = $(GSTREAMER_CFLAGS)
EXTRALIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS)
UNIX_CFLAGS = $(GSTREAMER_CFLAGS)
UNIX_LIBS = $(GSTREAMER_LIBS) $(PTHREAD_LIBS)
C_SRCS = \
color_convert.c \

View file

@ -3,7 +3,7 @@ MODULE = winemac.drv
UNIXLIB = winemac.so
IMPORTS = uuid rpcrt4 user32 gdi32 win32u
DELAYIMPORTS = ole32 shell32 imm32
EXTRALIBS = -lwin32u -framework AppKit -framework Carbon -framework Security -framework OpenGL -framework IOKit -framework CoreVideo -framework QuartzCore $(METAL_LIBS)
UNIX_LIBS = -lwin32u -framework AppKit -framework Carbon -framework Security -framework OpenGL -framework IOKit -framework CoreVideo -framework QuartzCore $(METAL_LIBS)
C_SRCS = \
clipboard.c \

View file

@ -2,8 +2,8 @@ MODULE = wineoss.drv
UNIXLIB = wineoss.so
IMPORTS = uuid ole32 user32 advapi32
DELAYIMPORTS = winmm
EXTRALIBS = $(OSS4_LIBS) $(PTHREAD_LIBS)
EXTRAINCL = $(OSS4_CFLAGS)
UNIX_LIBS = $(OSS4_LIBS) $(PTHREAD_LIBS)
UNIX_CFLAGS = $(OSS4_CFLAGS)
C_SRCS = \
midi.c \

View file

@ -1,8 +1,8 @@
MODULE = winepulse.drv
UNIXLIB = winepulse.so
IMPORTS = dxguid uuid winmm user32 advapi32 ole32 version
EXTRALIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -lm
EXTRAINCL = $(PULSE_CFLAGS)
UNIX_LIBS = $(PULSE_LIBS) $(PTHREAD_LIBS) -lm
UNIX_CFLAGS = $(PULSE_CFLAGS)
C_SRCS = \
mmdevdrv.c \

View file

@ -1,8 +1,8 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
MODULE = wineusb.sys
IMPORTS = ntoskrnl
EXTRALIBS = $(USB_LIBS)
EXTRAINCL = $(USB_CFLAGS)
UNIX_LIBS = $(USB_LIBS)
UNIX_CFLAGS = $(USB_CFLAGS)
EXTRADLLFLAGS = -Wl,--subsystem,native -mcygwin

View file

@ -2,7 +2,7 @@ MODULE = winevulkan.dll
UNIXLIB = winevulkan.so
IMPORTLIB = winevulkan
IMPORTS = user32 gdi32 advapi32 setupapi win32u
EXTRALIBS = $(PTHREAD_LIBS)
UNIX_LIBS = $(PTHREAD_LIBS)
C_SRCS = \
loader.c \

View file

@ -3,8 +3,8 @@ MODULE = winex11.drv
UNIXLIB = winex11.so
IMPORTS = uuid user32 gdi32 win32u
DELAYIMPORTS = comctl32 ole32 shell32 imm32
EXTRAINCL = $(X_CFLAGS)
EXTRALIBS = -lwin32u $(X_LIBS) $(X_EXTRA_LIBS) $(PTHREAD_LIBS) -lm
UNIX_CFLAGS = $(X_CFLAGS)
UNIX_LIBS = -lwin32u $(X_LIBS) $(X_EXTRA_LIBS) $(PTHREAD_LIBS) -lm
C_SRCS = \
bitblt.c \

View file

@ -2,8 +2,8 @@ MODULE = winspool.drv
UNIXLIB = winspool.so
IMPORTLIB = winspool
IMPORTS = user32 gdi32 advapi32
EXTRAINCL = $(CUPS_CFLAGS)
EXTRALIBS = $(APPLICATIONSERVICES_LIBS)
UNIX_CFLAGS = $(CUPS_CFLAGS)
UNIX_LIBS = $(APPLICATIONSERVICES_LIBS)
C_SRCS = \
cups.c \

View file

@ -2,8 +2,8 @@ MODULE = wldap32.dll
UNIXLIB = wldap32.so
IMPORTLIB = wldap32
IMPORTS = user32
EXTRAINCL = $(LDAP_CFLAGS)
EXTRALIBS = $(LDAP_LIBS)
UNIX_CFLAGS = $(LDAP_CFLAGS)
UNIX_LIBS = $(LDAP_LIBS)
C_SRCS = \
add.c \

View file

@ -2,7 +2,7 @@ MODULE = wpcap.dll
UNIXLIB = wpcap.so
IMPORTS = iphlpapi
DELAYIMPORTS = ws2_32
EXTRALIBS = $(PCAP_LIBS)
UNIX_LIBS = $(PCAP_LIBS)
C_SRCS = \
unixlib.c \

View file

@ -1,4 +1,4 @@
EXTRALIBS = $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(I386_LIBS)
UNIX_LIBS = $(COREFOUNDATION_LIBS) $(CORESERVICES_LIBS) $(I386_LIBS)
C_SRCS = \
c_037.c \

View file

@ -49,6 +49,6 @@ MANPAGES = \
wineserver.fr.UTF-8.man.in \
wineserver.man.in
EXTRALIBS = $(LDEXECFLAGS) $(RT_LIBS) $(INOTIFY_LIBS) $(PROCSTAT_LIBS)
UNIX_LIBS = $(LDEXECFLAGS) $(RT_LIBS) $(INOTIFY_LIBS) $(PROCSTAT_LIBS)
unicode_EXTRADEFS = -DNLSDIR="\"${nlsdir}\"" -DBIN_TO_NLSDIR=\"`${MAKEDEP} -R ${bindir} ${nlsdir}`\"

View file

@ -172,6 +172,7 @@ struct makefile
struct strarray include_paths;
struct strarray include_args;
struct strarray define_args;
struct strarray unix_cflags;
struct strarray programs;
struct strarray scripts;
struct strarray imports;
@ -2046,7 +2047,7 @@ static struct strarray add_unix_libraries( const struct makefile *make, struct s
unsigned int i, j;
if (strcmp( make->unixlib, "ntdll.so" )) strarray_add( &all_libs, "-lntdll" );
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" ));
for (i = 0; i < all_libs.count; i++)
{
@ -2277,9 +2278,11 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi
strarray_addall( &ret, make->include_args );
if (source->use_msvcrt)
{
strarray_add( &ret, strmake( "-I%s", root_src_dir_path( "include/msvcrt" )));
for (i = 0; i < make->include_paths.count; i++)
strarray_add( &ret, strmake( "-I%s", make->include_paths.str[i] ));
for (i = 0; i < make->include_paths.count; i++)
strarray_add( &ret, strmake( "-I%s", make->include_paths.str[i] ));
}
strarray_addall( &ret, make->define_args );
strarray_addall( &ret, get_expanded_file_local_var( make, obj, "EXTRADEFS" ));
if ((source->file->flags & FLAG_C_UNIX) && *dll_ext) strarray_add( &ret, "-DWINE_UNIX_LIB" );
@ -3004,6 +3007,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
output( "%s.o: %s\n", obj_dir_path( make, obj ), source->filename );
output( "\t%s$(CC) -c -o $@ %s", cmd_prefix( "CC" ), source->filename );
output_filenames( defines );
if (!source->use_msvcrt) output_filenames( make->unix_cflags );
output_filenames( make->extlib ? extra_cflags_extlib : extra_cflags );
if (make->sharedlib || (source->file->flags & FLAG_C_UNIX))
{
@ -3137,7 +3141,7 @@ static void output_module( struct makefile *make )
if (!make->use_msvcrt)
{
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" ));
strarray_addall( &all_libs, libs );
}
@ -3298,7 +3302,7 @@ static void output_unix_lib( struct makefile *make )
if (spec_file) strarray_add( &unix_deps, spec_file );
strarray_addall( &unix_libs, add_import_libs( make, &unix_deps, unix_imports, 0, 0 ));
strarray_addall( &unix_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &unix_libs, get_expanded_make_var_array( make, "UNIX_LIBS" ));
strarray_addall( &unix_libs, libs );
}
else unix_libs = add_unix_libraries( make, &unix_deps );
@ -3388,7 +3392,7 @@ static void output_shared_lib( struct makefile *make )
strarray_addall( &dep_libs, get_local_dependencies( make, basename, make->in_files ));
strarray_addall( &all_libs, get_expanded_file_local_var( make, basename, "LDFLAGS" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" ));
strarray_addall( &all_libs, libs );
output( "%s:", obj_dir_path( make, make->sharedlib ));
@ -3504,7 +3508,7 @@ static void output_programs( struct makefile *make )
if (!objs.count) objs = make->object_files;
if (!strarray_exists( &all_libs, "-nodefaultlibs" ))
{
strarray_addall( &all_libs, get_expanded_make_var_array( make, "EXTRALIBS" ));
strarray_addall( &all_libs, get_expanded_make_var_array( make, "UNIX_LIBS" ));
strarray_addall( &all_libs, libs );
}
@ -4148,6 +4152,7 @@ static void load_sources( struct makefile *make )
make->include_paths = empty_strarray;
make->include_args = empty_strarray;
make->define_args = empty_strarray;
make->unix_cflags = empty_strarray;
if (!make->extlib) strarray_add( &make->define_args, "-D__WINESRC__" );
value = get_expanded_make_var_array( make, "EXTRAINCL" );
@ -4167,6 +4172,7 @@ static void load_sources( struct makefile *make )
strarray_add_uniq( &make->define_args, value.str[i] );
}
strarray_addall( &make->define_args, get_expanded_make_var_array( make, "EXTRADEFS" ));
strarray_addall_uniq( &make->unix_cflags, get_expanded_make_var_array( make, "UNIX_CFLAGS" ));
strarray_add( &make->include_args, strmake( "-I%s", obj_dir_path( make, "" )));
if (make->src_dir)

View file

@ -1,6 +1,5 @@
PROGRAMS = sfnt2fon
UNIX_LIBS = $(FREETYPE_LIBS)
UNIX_CFLAGS = $(FREETYPE_CFLAGS)
C_SRCS = sfnt2fon.c
EXTRAINCL = $(FREETYPE_CFLAGS)
EXTRALIBS = $(FREETYPE_LIBS)

View file

@ -1,5 +1,6 @@
PROGRAMS = wmc
MANPAGES = wmc.man.in
UNIX_LIBS = $(GETTEXTPO_LIBS)
C_SRCS = \
lang.c \
@ -15,6 +16,4 @@ wmc_EXTRADEFS = \
-DNLSDIR="\"${nlsdir}\"" \
-DBIN_TO_NLSDIR=\"`${MAKEDEP} -R ${bindir} ${nlsdir}`\"
EXTRALIBS = $(GETTEXTPO_LIBS)
INSTALL_DEV = $(PROGRAMS)

View file

@ -1,5 +1,5 @@
PROGRAMS = wrc
EXTRALIBS = $(GETTEXTPO_LIBS)
UNIX_LIBS = $(GETTEXTPO_LIBS)
C_SRCS = \
genres.c \