Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: prettify and allow easier cross-compilation
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
- Loading branch information
1 parent
3e3594a
commit 49fe202
Showing
2 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,58 @@ | ||
|
||
############################################################################## | ||
## YOU SHOULD NOT EDIT THIS FILE, USE config INSTEAD | ||
## | ||
|
||
include config | ||
|
||
DFB_INC_DIR = $(shell pkg-config --variable=includedir directfb)/directfb/ | ||
ifneq ("$(origin V)", "command line") | ||
Q = @ | ||
endif | ||
|
||
LUA = lua | ||
CC = $(HOST_DIR)$(TARGET_NAME)gcc | ||
AR = $(HOST_DIR)$(TARGET_NAME)ar | ||
LD = $(CC) | ||
RM = rm | ||
STRIP = strip | ||
ECHO = @echo | ||
PKG_CONFIG = $(HOST_DIR)pkg-config | ||
|
||
DFB_INC_DIR = $(shell $(PKG_CONFIG) --variable=includedir directfb)/directfb/ | ||
DFB_HEADER = $(DFB_INC_DIR)directfb_keyboard.h $(DFB_INC_DIR)directfb.h | ||
|
||
CFLAGS = -Wall -fPIC $(shell pkg-config --cflags directfb $(LUA)) | ||
LDFLAGS = -shared $(shell pkg-config --libs directfb $(LUA)) | ||
INSTALL_DIR = $(shell pkg-config --variable INSTALL_CMOD $(LUA)) | ||
CFLAGS = -Wall -fPIC $(shell $(PKG_CONFIG) --cflags directfb $(LUA)) | ||
LDFLAGS = -shared $(shell $(PKG_CONFIG) --libs directfb $(LUA)) | ||
INSTALL_DIR = $(shell $(PKG_CONFIG) --variable INSTALL_CMOD $(LUA)) | ||
|
||
COMPAT_DIR := compat/ | ||
SRC_DIR := src/ | ||
SRC := $(wildcard $(SRC_DIR)*.c $(COMPAT_DIR)*.c) | ||
OBJ = $(SRC:.c=.o) | ||
|
||
OUTPUT=directfb.so | ||
|
||
$(OUTPUT): $(SRC) | ||
$(CC) $(CFLAGS) $(SRC) $(LDFLAGS) -o $@ | ||
$(OUTPUT): $(OBJ) | ||
$(Q)$(ECHO) " LD "$@; | ||
$(Q)$(LD) $^ $(LDFLAGS) -o $@ | ||
|
||
.c.o: | ||
$(Q)$(ECHO) " CC "$@; | ||
$(Q)$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
.gen.stamp: gendfb-lua.pl dir | ||
cat $(DFB_HEADER) | ./gendfb-lua.pl || exit 1 | ||
touch .gen.stamp | ||
$(Q)$(ECHO) "Generating from $(DFB_HEADER)" | ||
$(Q)cat $(DFB_HEADER) | ./gendfb-lua.pl || exit 1 | ||
$(Q)touch .gen.stamp | ||
|
||
tags: $(SRC_DIR)* $(DFB_HEADER) | ||
ctags $(SRC_DIR)* $(DFB_HEADER) | ||
$(Q)ctags $(SRC_DIR)* $(DFB_HEADER) | ||
|
||
.PHONY: install | ||
install: $(OUTPUT) | ||
cp $(OUTPUT) $(INSTALL_DIR) | ||
$(Q)cp $(OUTPUT) $(INSTALL_DIR) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f *.so $(SRC_DIR)* .gen.stamp | ||
$(Q)rm -f *.so $(SRC_DIR)* .gen.stamp | ||
|
||
.PHONY: gen | ||
gen: .gen.stamp | ||
|
||
.PHONY: dir | ||
dir: | ||
mkdir -p src | ||
$(Q)mkdir -p src |