diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-19 16:19:01 +0200 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-09-19 16:19:01 +0200 |
| commit | abe3588e56850403f7ebaf3c9090552e5f4830c6 (patch) | |
| tree | 2e9301bed577ca3d711361f255df43cd46a097da /exports/Makefile | |
| parent | 5f2e7ef988ac1267fe5038419b19b0154f9d5a84 (diff) | |
Exports: Simplify building
- Remove subdir c
- Do not compile c code as a separate shared library
- Move all definitions/declarations into the preamble as they shouldn't be shared anyways. So no headers are needed
- Define the callback as static, needed so we don't get a duplicate declaration
Diffstat (limited to 'exports/Makefile')
| -rw-r--r-- | exports/Makefile | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/exports/Makefile b/exports/Makefile index 46d17a9..1434f8b 100644 --- a/exports/Makefile +++ b/exports/Makefile @@ -2,8 +2,6 @@ include common.mk -CLIBPATH=./c - ifeq ($(LIB_SUFFIX),.so) # Add SONAME as cgo does not currently do this. Mostly for Android, see https://stackoverflow.com/a/48291044 export override CGO_LDFLAGS += -Wl,-soname,$(LIB_FILE) @@ -15,18 +13,12 @@ ifdef COPY_LIB_TO install $< -Dt $(COPY_LIB_TO) endif -${CLIBPATH}/libcommon$(LIB_SUFFIX): ${CLIBPATH}/common.c - $(CC) -c -Wall -Werror -fpic -o ${CLIBPATH}/common.o ${CLIBPATH}/common.c - $(CC) -shared -o $@ ${CLIBPATH}/common.o - # Build shared library and remove lib prefix (if any) from header name # GOOS and GOARCH envvars are set by common.mk # This extra target prevents unnecessary rebuild -lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): ${CLIBPATH}/libcommon$(LIB_SUFFIX) exports.go servers.go .. +lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): .. CGO_ENABLED=1 go build -o $@ -buildmode=c-shared . mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name clean: rm -rf ../exports/lib/* - rm -rf ${CLIBPATH}/common.o - rm -rf ${CLIBPATH}/libcommon.so |
