From fa6c81eee927d4125192eabbfc49844bf5d32802 Mon Sep 17 00:00:00 2001 From: nishi Date: Fri, 26 Apr 2024 23:30:15 +0000 Subject: [PATCH] add so git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@54 0f02c867-ac3d-714e-8a88-971ba1f6efcf --- Makefile | 8 ++++---- Serenade/Makefile | 7 +++++-- platform.mk | 2 -- platforms/win32.mk | 2 ++ platforms/win64.mk | 2 ++ 5 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 platform.mk diff --git a/Makefile b/Makefile index 4d8acb9..a676a01 100644 --- a/Makefile +++ b/Makefile @@ -2,16 +2,16 @@ CPP = cpp CC = cc -CFLAGS = -std=c99 -g `$(CPP) -DCFLAGS cmdline | grep -vE "^\#" | tr '\\n' ' '` +CFLAGS = -std=c99 -fPIC -g `$(CPP) -DCFLAGS cmdline | grep -vE "^\#" | tr '\\n' ' '` LDFLAGS = LIBS = `$(CPP) -DLIBS cmdline | grep -vE "^\#" | tr '\\n' ' '` EXTRA_OBJS = `$(CPP) -DOBJS cmdline | grep -vE "^\#" | tr '\\n' ' '` SUFFIX = +SUFFIX_SO = .so +PREFIX_SO = lib .if "$(PLATFORM)" != "" .include "platforms/${PLATFORM}.mk" -.else -.include "platform.mk" .endif .PHONY: all ./Serenade ./Tool replace format @@ -26,7 +26,7 @@ all: ./Tool ./config.h ./Serenade ./Tool/configgen $@ ./Serenade:: - $(MAKE) -C ./Serenade CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" SUFFIX="$(SUFFIX)" EXTRA_OBJS="$(EXTRA_OBJS)" + $(MAKE) -C ./Serenade CC="$(CC)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" SUFFIX="$(SUFFIX)" EXTRA_OBJS="$(EXTRA_OBJS)" SUFFIX_SO="$(SUFFIX_SO)" PREFIX_SO="$(PREFIX_SO)" clean: $(MAKE) -C ./Tool clean diff --git a/Serenade/Makefile b/Serenade/Makefile index fa66520..bf31395 100644 --- a/Serenade/Makefile +++ b/Serenade/Makefile @@ -5,13 +5,16 @@ SERENADE_OBJS = main.o parser.o util.o run.o interpreter.o $(EXTRA_OBJS) .PHONY: all clean .SUFFIXES: .o .c -all: ./serenade$(SUFFIX) +all: ./serenade$(SUFFIX) ./$(PREFIX_SO)serenade$(SUFFIX_SO) ./serenade$(SUFFIX): $(SERENADE_OBJS) $(CC) $(LDFLAGS) -o $@ $(SERENADE_OBJS) $(LIBS) +./$(PREFIX_SO)serenade$(SUFFIX_SO): $(SERENADE_OBJS) + $(CC) $(LDFLAGS) -shared -o $@ $(SERENADE_OBJS) $(LIBS) + .c.o: ../config.h $(CC) $(CFLAGS) -c -o $@ $< clean: - rm -f *.o ./serenade ./serenade.exe + rm -f *.o ./serenade ./serenade.exe ./*.so ./*.dll diff --git a/platform.mk b/platform.mk deleted file mode 100644 index 02b5f16..0000000 --- a/platform.mk +++ /dev/null @@ -1,2 +0,0 @@ -# $Id$ - diff --git a/platforms/win32.mk b/platforms/win32.mk index 5007c30..da6db0a 100644 --- a/platforms/win32.mk +++ b/platforms/win32.mk @@ -5,3 +5,5 @@ CPP = i686-w64-mingw32-cpp CC = i686-w64-mingw32-gcc CPP = i686-w64-mingw32-cpp SUFFIX = .exe +SUFFIX_SO = .dll +PREFIX_SO = diff --git a/platforms/win64.mk b/platforms/win64.mk index 5a788ee..5482e3b 100644 --- a/platforms/win64.mk +++ b/platforms/win64.mk @@ -5,3 +5,5 @@ CPP = x86_64-w64-mingw32-cpp CC = x86_64-w64-mingw32-gcc CPP = x86_64-w64-mingw32-cpp SUFFIX = .exe +SUFFIX_SO = .dll +PREFIX_SO = -- 2.43.0