Skip to content

Commit

Permalink
Fixing ExaequOS architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
Lecrapouille committed May 20, 2024
1 parent 6b78f99 commit 52956b2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 20 deletions.
12 changes: 12 additions & 0 deletions Makefile.footer
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@

include $(M)/Makefile.flags

###################################################
# Disable shared lib for ExaequOS for the moment
#
ifneq ($(EXAEQUOS),)
ifdef SHARED_LIB_TARGET
$(warning Sorry for the moment no shared lib can be created for ExaequOS)
SHARED_LIB_TARGET :=
endif
endif

###################################################
# Internal librairies
#
Expand Down Expand Up @@ -97,6 +107,7 @@ endif
###################################################
# Shared library
#
ifeq ($(EXAEQUOS),)
$(SHARED_LIB_TARGET): LDFLAGS += $(DLL_LDFLAGS)
$(SHARED_LIB_TARGET): $(LIB_OBJS) $(THIRDPART_OBJS) $(THIRDPART_LIBS)
ifeq ($(LIB_OBJS),)
Expand All @@ -105,6 +116,7 @@ endif
@$(call print-to,"Shared lib","$(TARGET)","$(BUILD)/$@","$(VERSION)")
$(Q)cd $(BUILD) && $(COMPILER) $(LDFLAGS) -o $@ $(LIB_OBJS) $(THIRDPART_OBJS) $(LINK_ALL_LOAD) $(THIRDPART_LIBS) $(NOT_PKG_LIBS) $(PKGCFG_LIBS) $(LINK_NO_ALL_LOAD) $(LINKER_FLAGS)
$(Q)cd $(BUILD) && cp $@ $(SHARED_LIB_TARGET_NOVERSION)
endif

###################################################
# Generate the pkg-config file
Expand Down
48 changes: 31 additions & 17 deletions Makefile.header
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ WIN_ENV := $(patsubst MINGW%,MINGW,$(WIN_ENV))
ARCHI := Windows
endif

###################################################
# Emscripten
#
ifneq ($(EMSCRIPTEN),)
$(warning Compiling with emscripten)
ARCHI := Emscripten
endif

###################################################
# Exaequos https://github.com/exaequos
#
ifneq ($(EXAEQUOS),)
$(warning Compiling with emscripten-exa for ExaequOS)
ARCHI := ExaequOS
endif

###################################################
# Macros to override through Makefile command lines
#
Expand Down Expand Up @@ -132,6 +116,26 @@ PROJECT_INFO ?= project_info.hpp
# MacOS X path to the application bundle icon
MACOS_BUNDLE_ICON ?= .makefile/macos.icns

###################################################
# Emscripten
#
ifneq ($(EXAEQUOS),)
#ifeq ($(EMSCRIPTEN),)
#$(error You are inside a docker but you did not call emmake)
#endif
ARCHI := Emscripten
CXX := em++.py
CC := emcc.py
AR := emar.py
ARFLAGS := crs
DEFINES += -DEXAEQUOS
endif

ifneq ($(EMSCRIPTEN),)
$(warning Compiling with emscripten)
ARCHI := Emscripten
endif

###################################################
# Check if some variables have been defined
#
Expand Down Expand Up @@ -177,7 +181,11 @@ TMPDIR ?= /tmp
# Application extension
#
ifeq ($(ARCHI),Emscripten)
ifneq ($(EXAEQUOS),)
EXT := .js
else
EXT := .html
endif
else ifeq ($(ARCHI),Darwin)
EXT := .app
else ifeq ($(ARCHI),Linux)
Expand Down Expand Up @@ -216,13 +224,18 @@ $(error Supported SUFFIX are $(CC_SUFFIX) or $(CXX_SUFFIX))
endif

###################################################
# Determine compiler name
# Determine compiler name. Exaequos em++.py does not work
#
ifeq ($(EXAEQUOS),)
COMPILER_NAME := $(shell $(COMPILER) --version | head -1 | cut -d" " -f1 | cut -d"-" -f1)
else
COMPILER_NAME := em++.py
endif

###################################################
# Determine compiler version
#
ifeq ($(EXAEQUOS),)
ifeq ("$(COMPILER_NAME)","clang")
COMPILER_VERSION := $(shell $(COMPILER) --version | head -1 | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
else ifeq ("$(COMPILER_NAME)","g++")
Expand All @@ -232,6 +245,7 @@ COMPILER_VERSION := $(shell $(COMPILER) --version | head -1 | grep -o -E '[0-9]+
else
COMPILER_VERSION := 0
endif
endif

###################################################
# Convert version number into a integer (ie g++-4.9.2 will return 40902)
Expand Down
26 changes: 23 additions & 3 deletions Makefile.macros
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ TARGET_LOWER_CASE := $(shell echo $(TARGET) | tr A-Z a-z)
#
SHORT_LIB_TARGET := -l$(TARGET_LOWER_CASE)
LIB_TARGET := lib$(TARGET_LOWER_CASE)
ifeq ($(EXAEQUOS),)
SHARED_LIB_TARGET_NOVERSION := $(LIB_TARGET).$(SO)
SHARED_LIB_TARGET := $(SHARED_LIB_TARGET_NOVERSION).$(TARGET_VERSION)
SHARED_LIB_TARGET_MAJOR := $(SHARED_LIB_TARGET_NOVERSION).$(TARGET_MAJOR_VERSION)
endif
STATIC_LIB_TARGET_NOVERSION := $(LIB_TARGET).a
STATIC_LIB_TARGET := $(STATIC_LIB_TARGET_NOVERSION).$(TARGET_VERSION)
STATIC_LIB_TARGET_MAJOR := $(STATIC_LIB_TARGET_NOVERSION).$(TARGET_MAJOR_VERSION)
Expand Down Expand Up @@ -256,18 +258,36 @@ endef
# Install static and dynamic libraries (if the project
# is not an application)
#
define INSTALL_PROJECT_LIBRARIES
@$(call print-to,"Installing","libs","$(INSTALL_LIBDIR)","")
@mkdir -p $(INSTALL_LIBDIR)
define INSTALL_PROJECT_STATIC_LIBRARIES
@install -m 644 $(BUILD)/$(STATIC_LIB_TARGET) $(INSTALL_LIBDIR)
@ln -snf $(INSTALL_LIBDIR)/$(STATIC_LIB_TARGET) $(INSTALL_LIBDIR)/$(STATIC_LIB_TARGET_NOVERSION)
@ln -snf $(INSTALL_LIBDIR)/$(STATIC_LIB_TARGET) $(INSTALL_LIBDIR)/$(STATIC_LIB_TARGET_MAJOR)
endef

define INSTALL_PROJECT_SHARED_LIBRARIES
@install -m 644 $(BUILD)/$(SHARED_LIB_TARGET) $(INSTALL_LIBDIR)
@ln -snf $(INSTALL_LIBDIR)/$(SHARED_LIB_TARGET) $(INSTALL_LIBDIR)/$(SHARED_LIB_TARGET_NOVERSION)
@ln -snf $(INSTALL_LIBDIR)/$(SHARED_LIB_TARGET) $(INSTALL_LIBDIR)/$(SHARED_LIB_TARGET_MAJOR)
@$(call INSTALL_PKG_CONFIG)
endef

###################################################
# Install static and dynamic libraries (if the project
# is not an application)
#
ifeq ($(EXAEQUOS),)
define INSTALL_PROJECT_LIBRARIES
@$(call print-to,"Installing","libs","$(INSTALL_LIBDIR)","")
@mkdir -p $(INSTALL_LIBDIR)
@$(call INSTALL_PROJECT_SHARED_LIBRARIES)
@$(call INSTALL_PROJECT_STATIC_LIBRARIES)
endef
else
@$(call print-to,"Installing","libs","$(INSTALL_LIBDIR)","")
@mkdir -p $(INSTALL_LIBDIR)
@$(call INSTALL_PROJECT_STATIC_LIBRARIES)
endif

###################################################
# Install all .hpp files to the $(INSTALL_INCLUDEDIR) folder
# TODO need glob regex
Expand Down

0 comments on commit 52956b2

Please sign in to comment.