Fixed some build issues

This commit is contained in:
NeGate 2022-06-02 15:55:10 -04:00
parent 712e116741
commit 55d39d289d
5 changed files with 18 additions and 16 deletions

View File

@ -2,14 +2,16 @@
// TODO: X-macros // TODO: X-macros
// TODO: data race possible (see 7.11.1.1 p. 5) // TODO: data race possible (see 7.11.1.1 p. 5)
// TODO: something about restoring locales (see 7.11.1.1 p. 8) // TODO: something about restoring locales (see 7.11.1.1 p. 8)
#include <locale.h>
#include<stddef.h> #include <limits.h>
#include <string.h>
#include <assert.h>
#define _LC_FIRST 0 #define _LC_FIRST 0
#define _LC_LAST 5 #define _LC_LAST 5
static struct lconv _locale; static struct lconv _locale;
static char *_locale_str; static const char *_locale_str;
char *setlocale(int category, const char *locale) char *setlocale(int category, const char *locale)
{ {

View File

@ -7,8 +7,6 @@
#define __STDC_WANT_LIB_EXT1__ 1 #define __STDC_WANT_LIB_EXT1__ 1
#endif #endif
#ifdef
// Compiler Identification // Compiler Identification
#if defined(_MSC_VER) && !defined(__clang__) #if defined(_MSC_VER) && !defined(__clang__)
@ -60,6 +58,4 @@
#ifdef __STDC_WANT_LIB_EXT1__ #ifdef __STDC_WANT_LIB_EXT1__
typedef int errno_t; typedef int errno_t;
typedef size_t rsize_t; typedef size_t rsize_t;
#endif
#endif #endif

View File

@ -1,6 +1,6 @@
GNUFLAGS=-Iinc -Icode GNUFLAGS=-Werror -Wall -Iinc -Icode
CLFLAGS=/link /incremental:no /subsystem:windows /nodefaultlib kernel32.lib CLFLAGS=/I:inc /link /incremental:no /subsystem:windows /nodefaultlib kernel32.lib
CC=clang CC=clang
CFLAGS=$(GNUFLAGS) CFLAGS=$(GNUFLAGS)
@ -9,12 +9,12 @@ LDFLAGS=/nologo /nodefaultlib /entry:mainCRTStartup
SRC_DIR := code SRC_DIR := code
OBJ_DIR := build OBJ_DIR := build
SRC_FILES := $(wildcard $(SRC_DIR)/*.c) SRC_FILES := $(wildcard $(SRC_DIR)/*.c)
OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRC_FILES)) OBJ_FILES := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.obj,$(SRC_FILES))
ciabatta.lib: $(OBJ_FILES) ciabatta.lib: $(OBJ_FILES)
lib $(LDFLAGS) /out:lib/$@ $^ lib $(LDFLAGS) /out:$@ $^
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(OBJ_DIR)/%.obj: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
.PHONY: ciabatta.lib .PHONY: ciabatta.lib

View File

@ -9,7 +9,7 @@ del temp
cl /Z7 /X /c /I ..\inc %includes% /nologo /GS- /Gm- /GR- /EHa- /Oi /W4 test.c cl /Z7 /X /c /I ..\inc %includes% /nologo /GS- /Gm- /GR- /EHa- /Oi /W4 test.c
::clang -c -Wall test.c -otest1.obj ::clang -c -Wall test.c -otest1.obj
link /nologo test.obj /nodefaultlib user32.lib kernel32.lib ..\lib\ciabatta.lib -subsystem:console link /nologo test.obj /nodefaultlib user32.lib kernel32.lib ..\ciabatta.lib -subsystem:console
::link /nologo test1.obj /nodefaultlib user32.lib kernel32.lib ..\lib\ciabatta.lib -subsystem:console ::link /nologo test1.obj /nodefaultlib user32.lib kernel32.lib ..\lib\ciabatta.lib -subsystem:console
popd popd

View File

@ -8,8 +8,12 @@ int main()
while(*include != 0) { while(*include != 0) {
printf("-I \""); printf("-I \"");
while(*include != ';' && *include != 0) { while(*include != ';' && *include != 0) {
printf("%c", *include); if (*include == '\\') {
*include ++; printf("/");
} else {
printf("%c", *include);
}
*include++;
} }
if(*include == ';') { if(*include == ';') {
++include; ++include;