You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
Makefile
54 lines
1.2 KiB
Makefile
SHELL=/bin/sh
|
|
CC=clang
|
|
|
|
ifeq ($(CC),clang)
|
|
CCX=clan
|
|
endif
|
|
|
|
OS=
|
|
ifeq ($(OS),windows)
|
|
CC=x86_64-w64-mingw32-gcc
|
|
endif
|
|
|
|
LIB_NAME=objc2
|
|
|
|
SRC=src
|
|
BUILD=build
|
|
INCLUDE= -I include -I .
|
|
CFLAGS= -std=gnu11
|
|
CPPFLAGS= -I /usr/include/x86_64-linux-gnu/c++/11 -I /usr/include/c++/11
|
|
|
|
C_FILES := $(shell find $(SRC) -name '*.c')
|
|
M_FILES := $(shell find $(SRC) -name '*.m')
|
|
CPP_FILES := $(shell find $(SRC) -name '*.cpp')
|
|
MM_FILES := $(shell find $(SRC) -name '*.mm')
|
|
O_FILES := $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(C_FILES))
|
|
O_FILES += $(patsubst $(SRC)/%.m, $(BUILD)/%.o, $(M_FILES))
|
|
O_FILES += $(patsubst $(SRC)/%.cc, $(BUILD)/%.o, $(CPP_FILES))
|
|
O_FILES += $(patsubst $(SRC)/%.mm, $(BUILD)/%.o, $(MM_FILES))
|
|
|
|
.PHONY: all clean dll
|
|
|
|
all: $(LIB_NAME)
|
|
|
|
dll: $(O_FILES)
|
|
$(CC) $< -shared -o objc2.dll
|
|
|
|
$(LIB_NAME): $(O_FILES)
|
|
ar rcs lib$(LIB_NAME).a $(O_FILES)
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.c
|
|
$(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.m
|
|
$(CC) -fobjc-exceptions $(CFLAGS) -DEMBEDDED_BLOCKS_RUNTIME $(INCLUDE) -c $< -o $@
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.cc
|
|
$(CCX)g++ $(CPPFLAGS) $(INCLUDE) -c $< -o $@
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.mm
|
|
$(CCX)g++ $(CPPFLAGS) $(INCLUDE) -c $< -o $@
|
|
|
|
|
|
clean: build
|
|
rm $(BUILD)/*.o
|