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.
41 lines
643 B
Makefile
41 lines
643 B
Makefile
SHELL=/bin/sh
|
|
CC=
|
|
AR=
|
|
|
|
LIB_NAME=yeslib
|
|
|
|
SRC=src
|
|
BUILD=build
|
|
|
|
C_FILES := $(shell find $(SRC) -name '*.c')
|
|
M_FILES := $(shell find $(SRC) -name '*.m')
|
|
O_FILES := $(patsubst $(SRC)/%.m, $(BUILD)/%.o, $(M_FILES))
|
|
O_FILES += $(patsubst $(SRC)/%.c, $(BUILD)/%.o, $(C_FILES))
|
|
|
|
LIB :=
|
|
OS :=
|
|
|
|
ifeq ($(OS),windows)
|
|
CC=x86_64-w64-mingw32-gcc
|
|
AR=x86_64-w64-mingw32-ar
|
|
LIB += -lopengl32 -lgdi32 -lwinmm -luser32
|
|
endif
|
|
|
|
ifeq ($(OS),linux)
|
|
CC=gcc
|
|
AR=ar
|
|
endif
|
|
|
|
static: $(LIB_NAME)
|
|
|
|
$(LIB_NAME): $(O_FILES)
|
|
$(AR) rcs lib$(LIB_NAME).a $(O_FILES)
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.c
|
|
$(CC) -c $< -o $@
|
|
|
|
$(BUILD)/%.o: $(SRC)/%.m
|
|
$(CC) -c $< -o $@
|
|
|
|
clean:
|
|
rm $(BUILD)/*.o
|