Skip to content

Commit

Permalink
Merge pull request #85 from turbolent/static-dynamic-separation
Browse files Browse the repository at this point in the history
Separate dynamic and static functions based on reference module
  • Loading branch information
turbolent authored Nov 9, 2023
2 parents 524d919 + 0e3b538 commit ae20cde
Show file tree
Hide file tree
Showing 14 changed files with 697 additions and 107 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
env:
LDFLAGS: -static
working-directory: ./w2c2
run: make BUILD=${{ matrix.build }} FEATURES="unistd libgen getopt ${{ matrix.threads && 'threads' || '' }}"
run: make BUILD=${{ matrix.build }} FEATURES="unistd libgen getopt glob ${{ matrix.threads && 'threads' || '' }}"
- if: steps.changes.outputs.w2c2 == 'true'
name: Run w2c2 tests
env:
Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:
- if: steps.changes.outputs.w2c2 == 'true'
name: Build w2c2
working-directory: ./w2c2
run: make BUILD=${{ matrix.build }} FEATURES="unistd libgen getopt ${{ matrix.threads && 'threads' || '' }}"
run: make BUILD=${{ matrix.build }} FEATURES="unistd libgen getopt glob ${{ matrix.threads && 'threads' || '' }}"
- if: steps.changes.outputs.w2c2 == 'true'
name: Run tests
working-directory: ./tests
Expand Down
5 changes: 5 additions & 0 deletions w2c2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ include(CheckIncludeFile)
check_include_file(getopt.h HAVE_GETOPT_H)
check_include_file(libgen.h HAVE_LIBGEN_H)
check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(glob.h HAVE_GLOB_H)

include(CheckSymbolExists)
check_symbol_exists(strdup string.h HAVE_STRDUP)
Expand Down Expand Up @@ -77,6 +78,10 @@ foreach(TARGET w2c2 w2c2_test)
target_compile_definitions(${TARGET} PUBLIC HAS_STRDUP=1)
endif()

if(HAVE_GLOB_H)
target_compile_definitions(${TARGET} PUBLIC HAS_GLOB=1)
endif()

if(MSVC)
target_compile_definitions(${TARGET} PUBLIC _CRT_SECURE_NO_DEPRECATE)
endif()
Expand Down
7 changes: 6 additions & 1 deletion w2c2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ CFLAGS += -std=c89 $(WARNS)
# - unistd.h
# - libgen.h
# - strdup
FEATURES ?= threads getopt unistd libgen strdup
# - glob
FEATURES ?= threads getopt unistd libgen strdup glob

ifeq ($(UNAME),Windows)
OUTPUT := w2c2.exe
Expand Down Expand Up @@ -62,6 +63,10 @@ ifneq (,$(findstring strdup,$(FEATURES)))
CFLAGS += -DHAS_STRDUP=1
endif

ifneq (,$(findstring glob,$(FEATURES)))
CFLAGS += -DHAS_GLOB=1
endif

ifneq (,$(findstring debugging,$(FEATURES)))
CFLAGS += -DHAS_LIBDWARF=1
LDFLAGS += -ldwarf
Expand Down
Loading

0 comments on commit ae20cde

Please sign in to comment.