Permalink
Browse files

Generate files in Android.mk, now ready for system build

Change-Id: I6df62836be1b657f2510b09f30adca4d425a7b9e
  • Loading branch information...
1 parent b239859 commit 97597459d77d53fb2bc6c9192a89e1c392a8749a @bukington committed Feb 2, 2011
Showing with 32 additions and 4 deletions.
  1. +28 −1 Android.mk
  2. +4 −3 src/tty.sh
View
@@ -13,7 +13,9 @@ LOCAL_SRC_FILES += $(MY_FILES)
#LOCAL_SRC_FILES += $(wildcard *.c)
#LOCAL_SRC_FILES += $(foreach F, $(APP_SUBDIRS), $(addprefix $(F)/,$(notdir $(wildcard $(LOCAL_PATH)/$(F)/*.c))))
-LOCAL_MODULE:= screen
+LOCAL_MODULE := screen
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_MODULE_TAGS := eng
LOCAL_SHARED_LIBRARIES := libncurses
@@ -25,4 +27,29 @@ LOCAL_CFLAGS := -g -O2 -Dandroid \
-DGIT_REV=\"`git describe --always 2>/dev/null`\" \
-DSCREEN=\"screen-$(VERSION)\"
+LOCAL_SHARED_LIBRARIES := libncurses
+
+intermediates:= $(local-intermediates-dir)
+GEN := $(addprefix $(intermediates)/src/, \
+ osdef.h \
+ comm.h \
+ term.h \
+ )
+$(GEN): PRIVATE_INPUT_FILE = $<
+$(GEN): PRIVATE_CUSTOM_TOOL = $(shell cd $(LOCAL_PATH)/src && \
+ sh $(patsubst $(LOCAL_PATH)/src/%,%,$(PRIVATE_INPUT_FILE)) \
+ )
+$(GEN): $(intermediates)/src/%.h : $(LOCAL_PATH)/src/%.sh
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+GEN := $(intermediates)/src/tty.c
+$(GEN): PRIVATE_INPUT_FILE = $<
+$(GEN): PRIVATE_CUSTOM_TOOL = $(shell cd $(LOCAL_PATH)/src && \
+ sh $(patsubst $(LOCAL_PATH)/src/%,%,$(PRIVATE_INPUT_FILE)) \
+ )
+$(GEN): $(intermediates)/src/%.c : $(LOCAL_PATH)/src/%.sh
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
include $(BUILD_EXECUTABLE)
View
@@ -2,12 +2,13 @@
# sh tty.sh tty.c
# This inserts all the needed #ifdefs for IF{} statements
# and generates tty.c
+TARGET=tty.c
#
# Stupid cpp on A/UX barfs on ``#if defined(FOO) && FOO < 17'' when
# FOO is undefined. Reported by Robert C. Tindall (rtindall@uidaho.edu)
#
-rm -f $1
+rm -f $TARGET
sed -e '1,26d' \
-e 's%^IF{\([^}]*\)}\(.*\)%#if defined(\1)\
\2\
@@ -20,8 +21,8 @@ sed -e '1,26d' \
\2\
#endif \
#endif /* \1 */%' \
- < $0 > $1
-chmod -w $1
+ < $0 > $TARGET
+chmod -w $TARGET
exit 0
/* Copyright (c) 2008, 2009

0 comments on commit 9759745

Please sign in to comment.