Initial release

This commit is contained in:
Pierre Pronchery 2006-10-22 13:14:26 +00:00
commit d3fc4dc131
3 changed files with 99 additions and 0 deletions

37
src/Makefile Normal file
View File

@ -0,0 +1,37 @@
TARGETS = c99
PREFIX = /usr/local
DESTDIR =
BINDIR = $(PREFIX)/bin
INCLUDEDIR= $(PREFIX)/include
CC = cc
CFLAGSF = -W
CFLAGS = -g
RM = rm -f
MKDIR = mkdir -p
INSTALL = install
all: $(TARGETS)
c99_OBJS = c99.o
c99_CFLAGS = $(CFLAGSF) $(CFLAGS)
c99: $(c99_OBJS)
$(CC) $(LDFLAGSF) $(LDFLAGS) -o c99 $(c99_OBJS)
c99.o: c99.c
$(CC) $(c99_CFLAGS) -c c99.c
clean:
$(RM) $(c99_OBJS)
distclean: clean
$(RM) $(TARGETS)
install: all
$(MKDIR) $(DESTDIR)$(BINDIR)
$(INSTALL) -m 0755 c99 $(DESTDIR)$(BINDIR)/c99
uninstall:
$(RM) $(DESTDIR)$(BINDIR)/c99
.PHONY: all clean distclean install uninstall

55
src/c99.c Normal file
View File

@ -0,0 +1,55 @@
/* $id$ */
/* Copyright (c) 2006 The DeforaOS Project */
#include <unistd.h>
#include <stdio.h>
/* types */
typedef int Prefs;
#define PREFS_c 0x1
#define PREFS_E 0x2
#define PREFS_g 0x4
#define PREFS_s 0x8
/* usage */
static int _usage(void)
{
fprintf(stderr, "%s", "Usage: c99 [-c][-D name[=value]]...[-E][-g][-I directory][-L directory][-o outfile][-Ooptlevel][-s][-U name]... operand ...\n");
return 1;
}
/* main */
int main(int argc, char * argv[])
{
Prefs prefs = 0;
char * outfile = NULL;
int o;
char oldo = '\0';
for(; (o = getopt(argc, argv, "cD:EgI:L:o:O123sU:")) != -1; oldo = o)
switch(o)
{
case 'c':
prefs |= PREFS_c;
break;
case 'E':
prefs |= PREFS_E;
break;
case 'g':
prefs |= PREFS_g;
break;
case 'o':
outfile = optarg;
break;
case 's':
prefs |= PREFS_s;
break;
default:
return _usage();
}
}

7
src/project.conf Normal file
View File

@ -0,0 +1,7 @@
targets=c99
cflags_force=-W
cflags=-g
[c99]
type=binary
sources=c99.c