skint/Makefile

95 lines
1.6 KiB
Makefile
Raw Normal View History

2024-07-27 23:15:30 +02:00
CFLAGS = -O3 -DNDEBUG
LDFLAGS =
PREFIX = /usr/local
INSTALL = install -m 755 -s
UNINSTALL = rm -f
RM = rm -f
ARCH = unknown
ifneq ($(shell which clang),)
$(info clang is detected)
CC = clang
else
CC = gcc
endif
ifeq ($(OS),Windows_NT)
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
ARCH = AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
ARCH = AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
ARCH = IA32
endif
endif
else
2024-08-08 06:20:24 +02:00
UNAME := $(shell uname -p)
ifeq ($(UNAME),unknown)
UNAME := $(shell uname -m)
endif
ifeq ($(UNAME),x86_64)
2024-07-27 23:15:30 +02:00
ARCH = AMD64
endif
2024-08-08 06:20:24 +02:00
ifneq ($(filter %86,$(UNAME)),)
2024-07-27 23:15:30 +02:00
ARCH = IA32
endif
2024-08-08 06:20:24 +02:00
ifneq ($(filter arm%,$(UNAME)),)
2024-07-27 23:15:30 +02:00
ARCH = ARM
endif
2024-08-08 06:37:02 +02:00
ifeq ($(UNAME),riscv64)
ARCH = RV64
endif
2024-07-27 23:15:30 +02:00
endif
ifeq ($(ARCH),AMD64)
$(info x86_64 architecture is detected)
CFLAGS += -D NAN_BOXING
endif
2024-08-08 06:37:02 +02:00
ifeq ($(ARCH),RV64)
$(info RISCV_64 architecture is detected)
CFLAGS += -D NAN_BOXING
endif
2024-07-27 23:15:30 +02:00
2024-07-28 16:32:34 +02:00
.PHONY: all clean realclean test install uninstall
2024-07-27 23:15:30 +02:00
exe = ./skint
sources = s.c \
k.c \
i.c \
n.c \
t.c
includes = i.h \
n.h \
s.h
objects = $(sources:%.c=%.o)
all: $(exe)
2024-07-28 16:32:34 +02:00
test:
$(exe) misc/test.scm
2024-07-27 23:15:30 +02:00
clean:
2024-07-28 16:17:13 +02:00
$(RM) $(objects)
realclean:
2024-07-27 23:15:30 +02:00
$(RM) $(objects) $(exe)
install:
$(INSTALL) $(exe) $(PREFIX)/bin
uninstall:
$(UNINSTALL) $(exe) $(PREFIX)/bin
$(exe): $(objects)
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(objects) -lm
$(objects): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(objects): $(includes)