Skip to content

Instantly share code, notes, and snippets.

@upsuper upsuper/Makefile

Created Mar 21, 2012
Embed
What would you like to do?
中文C编程
#define 主函数 main
#define 整数 int
#define 返回 return
#define 打印 printf
#include <stdio.h>
整数 主函数()
{
打印("你好世界\n");
返回 0;
}
CFLAGS=-fextended-identifiers -std=c99
objects=chinese.ucn.o
target=chinese
.PHONY: all clean
all: $(target)
$(target): $(objects)
$(CC) $< -o $@
$(objects): %.o: %.c
$(objects:%.o=%.c): %.ucn.c: %.c
./to_UCN.sh $< $@
clean:
-rm $(target) *.o *.ucn.c
#!/bin/bash
cat $1 | perl -pe 'BEGIN { binmode STDIN, ":utf8"; } s/(.)/ord($1) < 128 ? $1 : sprintf("\\U%08x", ord($1))/ge;' > $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.