diff --git a/Makefile b/Makefile
index 899334a..8868554 100644
--- a/Makefile
+++ b/Makefile
@@ -1,96 +1,140 @@
-#
-# dlfcn-win32 Makefile
-#
-include config.mak
-CFLAGS = -Wall -O3 -fomit-frame-pointer -Isrc
-
-ifeq ($(BUILD_SHARED),yes)
- TARGETS += libdl.dll
- SHFLAGS += -Wl,--out-implib,libdl.dll.a
- INSTALL += shared-install
- TESTS += test.exe test-dladdr.exe
-endif
-ifeq ($(BUILD_STATIC),yes)
- TARGETS += libdl.a
- INSTALL += static-install
- TESTS += test-static.exe test-dladdr-static.exe
-endif
-ifeq ($(BUILD_MSVC),yes)
- TARGETS += libdl.lib
- SHFLAGS += -Wl,--output-def,libdl.def
- INSTALL += lib-install
-endif
-
-SOURCES := src/dlfcn.c
-HEADERS := src/dlfcn.h
-
-all: $(TARGETS)
-
-libdl.a: $(SOURCES)
- $(CC) $(CFLAGS) -o $(^:%.c=%.o) -c $^
- $(AR) cru $@ $(SOURCES:%.c=%.o)
- $(RANLIB) $@
-
-libdl.dll: $(SOURCES)
- $(CC) $(CFLAGS) $(SHFLAGS) -DDLFCN_WIN32_SHARED -shared -o $@ $^
-
-libdl.lib: libdl.dll
- $(LIBCMD) /machine:i386 /def:libdl.def
-
-include-install: $(HEADERS)
- mkdir -p $(DESTDIR)$(incdir)
- install -m 644 $^ "$(DESTDIR)$(incdir)"
-
-shared-install: include-install
- mkdir -p $(DESTDIR)$(prefix)/bin
- cp libdl.dll $(DESTDIR)$(prefix)/bin
- $(STRIP) $(DESTDIR)$(prefix)/bin/libdl.dll
- mkdir -p $(DESTDIR)$(libdir)
- cp libdl.dll.a $(DESTDIR)$(libdir)
-
-static-install: include-install
- mkdir -p $(DESTDIR)$(libdir)
- cp libdl.a $(DESTDIR)$(libdir)
-
-lib-install:
- mkdir -p $(DESTDIR)$(libdir)
- cp libdl.lib $(DESTDIR)$(libdir)
-
-install: $(INSTALL)
-
-test.exe: tests/test.c $(TARGETS)
- $(CC) $(CFLAGS) -o $@ $< libdl.dll.a
-
-test-static.exe: tests/test.c $(TARGETS)
- $(CC) $(CFLAGS) -o $@ $< libdl.a
-
-test-dladdr.exe: tests/test-dladdr.c $(TARGETS)
- $(CC) $(CFLAGS) -Wl,--export-all-symbols -DDLFCN_WIN32_SHARED -o $@ $< libdl.dll.a
-
-test-dladdr-static.exe: tests/test-dladdr.c $(TARGETS)
- $(CC) $(CFLAGS) -Wl,--export-all-symbols -o $@ $< libdl.a
-
-testdll.dll: tests/testdll.c
- $(CC) $(CFLAGS) -shared -o $@ $^
-
-testdll2.dll: tests/testdll2.c $(TARGETS)
- $(CC) $(CFLAGS) -shared -o $@ $< -L. -ldl
-
-testdll3.dll: tests/testdll3.c
- $(CC) -shared -o $@ $^
-
-test: $(TARGETS) $(TESTS) testdll.dll testdll2.dll testdll3.dll
- for test in $(TESTS); do $(WINE) $$test || exit 1; done
-
-clean::
- rm -f \
- src/dlfcn.o \
- libdl.dll libdl.a libdl.def libdl.dll.a libdl.lib libdl.exp \
- tmptest.c tmptest.dll \
- test-dladdr.exe test-dladdr-static.exe \
- test.exe test-static.exe testdll.dll testdll2.dll testdll3.dll
-
-distclean: clean
- rm -f config.mak
-
-.PHONY: clean distclean install test
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 3.31
+
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
+
+# Allow only one "make -f Makefile2" at a time, but pass parallelism.
+.NOTPARALLEL:
+
+#=============================================================================
+# Special targets provided by cmake.
+
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
+
+# Disable VCS-based implicit rules.
+% : %,v
+
+# Disable VCS-based implicit rules.
+% : RCS/%
+
+# Disable VCS-based implicit rules.
+% : RCS/%,v
+
+# Disable VCS-based implicit rules.
+% : SCCS/s.%
+
+# Disable VCS-based implicit rules.
+% : s.%
+
+.SUFFIXES: .hpux_make_needs_suffix_list
+
+# Command-line flag to silence nested $(MAKE).
+$(VERBOSE)MAKESILENT = -s
+
+#Suppress display of executed commands.
+$(VERBOSE).SILENT:
+
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
+
+#=============================================================================
+# Set environment variables for the build.
+
+# The shell in which to execute make rules.
+SHELL = /bin/sh
+
+# The CMake executable.
+CMAKE_COMMAND = /usr/bin/cmake.exe
+
+# The command to remove a file.
+RM = /usr/bin/cmake.exe -E rm -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/thoxd/c/thodg/kc3-lang/dlfcn-win32
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/thoxd/c/thodg/kc3-lang/dlfcn-win32
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake cache editor..."
+ /usr/bin/ccmake.exe -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..."
+ /usr/bin/cmake.exe --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/thoxd/c/thodg/kc3-lang/dlfcn-win32/CMakeFiles /home/thoxd/c/thodg/kc3-lang/dlfcn-win32//CMakeFiles/progress.marks
+ $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/thoxd/c/thodg/kc3-lang/dlfcn-win32/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+ $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+ $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+ $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+ $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+# Help Target
+help:
+ @echo "The following are some of the valid targets for this Makefile:"
+ @echo "... all (the default if no target is provided)"
+ @echo "... clean"
+ @echo "... depend"
+ @echo "... edit_cache"
+ @echo "... rebuild_cache"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+ $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+