LuPPC/Makefile

59 lines
1.2 KiB
Makefile
Raw Normal View History

2016-01-19 05:42:32 +11:00
# TARGET=arm-none-eabi
#CC=$(TARGET)-gcc
CC=gcc
2016-01-19 05:42:32 +11:00
2016-01-19 07:24:13 +11:00
CFLAGS=-O2 -std=c90 -Isrc/lib/lua -Iinclude -DLUA_C89_NUMBERS
2016-01-04 04:08:43 +11:00
BUILD = bin/
SOURCE = src/c/
2016-01-03 13:25:12 +11:00
CORELUA = src/lua/core
2016-01-04 04:08:43 +11:00
LIBS=-lm
2016-01-03 13:25:12 +11:00
GENERATED=include/luares.h src/c/gen/luares.c
LUAPARAMS = $(CORELUA) include/luares.h src/c/gen/luares.c lua_
2016-01-04 04:08:43 +11:00
LDFLAGS=-static
2016-01-03 13:25:12 +11:00
2016-01-04 04:08:43 +11:00
SRCDIRECTORIES = $(shell find $(SOURCE) -type d)
2016-01-03 13:25:12 +11:00
BUILDDIRECTORIES = $(patsubst $(SOURCE)%, $(BUILD)%, $(SRCDIRECTORIES))
2016-01-04 04:08:43 +11:00
CFILES = $(shell find $(SOURCE) -type f -name '*.c')
OBJECTS := $(patsubst $(SOURCE)%.c, $(BUILD)%.c.o, $(CFILES))
2016-01-03 13:25:12 +11:00
#Rules
2016-01-04 04:08:43 +11:00
#Prepare
$(BUILDDIRECTORIES):
2016-01-05 04:20:40 +11:00
mkdir -p $@
2016-01-04 04:08:43 +11:00
2016-01-03 13:25:12 +11:00
#Build
2016-01-04 04:08:43 +11:00
all: smallclean $(BUILDDIRECTORIES) luaresources $(BUILD)lupi
2016-01-03 13:25:12 +11:00
build: clean all
2016-01-04 04:08:43 +11:00
$(BUILD)lupi: $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) -o $@ $(LIBS)
2016-01-19 08:19:10 +11:00
$(BUILD)%.c.o: $(SOURCE)%.c
$(CC) -c $(CFLAGS) -I /usr/include -I src/c -I src/c/lib/lua $< -o $@
2016-01-03 13:25:12 +11:00
#Resources
luaresources: cleanresourcues
scripts/txt2c $(LUAPARAMS)
#Clean rules
cleanresourcues:
-rm -f $(GENERATED)
mkdir -p src/c/gen/
touch src/c/gen/luares.c
touch include/luares.h
2016-01-04 04:08:43 +11:00
clean: cleanresourcues
-rm -rf $(BUILD)
2016-01-19 05:42:32 +11:00
smallclean:
find . -name '*~' -type f -exec rm {} \;
# Other
.PHONY: clean cleanresourcues luaresources build smallclean all