Add support for MUSL on Linux

This commit is contained in:
Andrew Pamment 2018-10-16 13:48:47 +10:00
parent 8f8a8d1b67
commit c3e21a5228
5 changed files with 53 additions and 3 deletions

View File

@ -1,4 +1,8 @@
OS:= $(shell uname -s | tr '[A-Z]' '[a-z]' | sed 's/darwin/osx/')
ifdef MUSL
OS=linux-musl
else
OS=$(shell uname -s | tr '[A-Z]' '[a-z]' | sed 's/darwin/osx/')
endif
all: magicka

29
deps/jamlib/Makefile.linux-musl vendored Normal file
View File

@ -0,0 +1,29 @@
CC = cc $(CPPFLAGS) $(CFLAGS) -D__LINUX__ $(LDFLAGS) -Wall
AR = ar -ru
RM = rm -f
OBJS = crc32.o mbase.o message.o lastread.o subpack.o structrw.o
jamlib.a : $(OBJS)
$(AR) jamlib.a $(OBJS)
crc32.o: crc32.c jam.h
$(CC) -c crc32.c -o crc32.o
mbase.o: mbase.c jam.h
$(CC) -c mbase.c -o mbase.o -D__MUSL__=1
message.o: message.c jam.h
$(CC) -c message.c -o message.o
lastread.o: lastread.c jam.h
$(CC) -c lastread.c -o lastread.o
subpack.o: subpack.c jam.h
$(CC) -c subpack.c -o subpack.o
structrw.o: structrw.c jam.h
$(CC) -c structrw.c -o structrw.o
clean:
$(RM) *.o *.a

View File

@ -89,7 +89,7 @@ magichat: ${JSMN}
cd ${UTILSDIR}/magichat && ${MAKE}
filecenter: ${CDK}
cd ${UTILSDIR}/filecenter && ${MAKE}
cd ${UTILSDIR}/filecenter && ${MAKE} ${FTSLIB}
dosbox_shim:
cd ${UTILSDIR}/dosbox_shim && ${MAKE}

View File

@ -0,0 +1,13 @@
CC:= cc
CFLAGS:= -std=gnu99 -I/usr/local/include
LIBS:= -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -lmosquitto -lfts
EXTRAOBJS:= strlcpy/strlcpy.o strlcpy/strlcat.o
LIBTOOLIZE:= libtoolize
DEPS_LUA_TARGET:= linux
DEPS_JAMLIB_MAKEFILE:= Makefile.linux-musl
FTSLIB:= FTSLIB=1
include GNUmakefile.common

View File

@ -23,8 +23,12 @@ endif
ifeq ($(OS), Linux)
CC=gcc
CFLAGS=
ifdef FTSLIB
LDFLAGS=-lsqlite3 -lncurses -lfts
else
LDFLAGS=-lsqlite3 -lncurses
endif
endif
ifeq ($(OS), Darwin)
CC=cc
CFLAGS=