Skip to content

Commit

Permalink
ST: Fix build issues for Cygwin64 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jul 27, 2021
1 parent 3f69416 commit 3202a77
Show file tree
Hide file tree
Showing 8 changed files with 469 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
DARWIN_*_DBG
LINUX_*_DBG
CYGWIN_*_DBG
obj
st.pc
.idea
Expand Down
8 changes: 8 additions & 0 deletions .run/cygwin64-debug.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="cygwin64-debug" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="Makefile" target="cygwin64-debug" workingDirectory="$PROJECT_DIR$" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
</component>
8 changes: 8 additions & 0 deletions .run/darwin-debug.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="darwin-debug" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="Makefile" target="darwin-debug" workingDirectory="$PROJECT_DIR$" arguments="">
<envs />
</makefile>
<method v="2" />
</configuration>
</component>
23 changes: 22 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ ECHO = /bin/echo
BUILD = DBG
TARGETDIR = $(OS)_$(shell uname -r)_$(BUILD)

# For cygwin/windows, the 'uname -r' generate path with parentheses,
# which cause the make fails, so we use 'uname -s' instead.
ifeq ($(OS), CYGWIN64)
TARGETDIR = $(OS)_$(shell uname -s)_$(BUILD)
endif

DEFINES = -D$(OS)
CFLAGS =
SFLAGS =
Expand All @@ -73,7 +79,8 @@ DESC = st.pc
# Possible targets:

TARGETS = darwin-debug darwin-optimized \
linux-debug linux-optimized
linux-debug linux-optimized \
cygwin64-debug

UTEST_TARGETS = darwin-debug-utest linux-debug-utest \
darwin-debug-gcov linux-debug-gcov
Expand Down Expand Up @@ -102,6 +109,14 @@ OTHER_FLAGS = -Wall
DEFINES += -DMD_HAVE_EPOLL
endif

ifeq ($(OS), CYGWIN64)
EXTRA_OBJS = $(TARGETDIR)/md_cygwin64.o
SFLAGS = -fPIC
LDFLAGS = -shared -soname=$(SONAME) -lc
OTHER_FLAGS = -Wall
DEFINES += -DMD_HAVE_SELECT
endif

#
# End of platform section.
##########################
Expand Down Expand Up @@ -249,6 +264,9 @@ $(TARGETDIR)/md_linux.o: md_linux.S
$(TARGETDIR)/md_darwin.o: md_darwin.S
$(CC) $(CFLAGS) -c $< -o $@

$(TARGETDIR)/md_cygwin64.o: md_cygwin64.S
$(CC) $(CFLAGS) -c $< -o $@

$(TARGETDIR)/%.o: %.c common.h md.h
$(CC) $(CFLAGS) -c $< -o $@

Expand Down Expand Up @@ -281,6 +299,9 @@ linux-debug:
linux-optimized:
$(MAKE) OS="LINUX" BUILD="OPT"

cygwin64-debug:
$(MAKE) OS="CYGWIN64" BUILD="DBG"

darwin-debug-utest:
@echo "Build utest for state-threads"
$(MAKE) OS="DARWIN" BUILD="DBG"
Expand Down
Loading

0 comments on commit 3202a77

Please sign in to comment.