X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=Makefile;h=272bbee43ecd52f847a3b80280eb3548f95df9ac;hb=9634f9c53e95b6bdc7883228c5ec5147f3de4f8e;hp=aaadd3e67748c80e2c24319c14d04a3bfd6137cc;hpb=f017f4f5080052f95185056b3af472ab737bc64a;p=cparser diff --git a/Makefile b/Makefile index aaadd3e..272bbee 100644 --- a/Makefile +++ b/Makefile @@ -7,16 +7,15 @@ BUILDDIR ?= build FIRM_CFLAGS ?= `pkg-config --cflags libfirm` FIRM_LIBS ?= `pkg-config --libs libfirm` -CPPFLAGS = -DHAVE_CONFIG_H -DFIRM_BACKEND -CPPFLAGS += -I. +CPPFLAGS = -I. CPPFLAGS += $(FIRM_CFLAGS) -CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes -Werror -std=c99 -pedantic -CFLAGS += -O0 -g3 +CFLAGS += -Wall -W -Wstrict-prototypes -Wmissing-prototypes -std=c99 -pedantic +CFLAGS += -O2 -g #CFLAGS += -O3 -march=pentium4 -fomit-frame-pointer -DNDEBUG #CFLAGS += -pg -O3 -fno-inline -ICC_CFLAGS = -O0 -g3 -std=c99 -Wall -Werror -LFLAGS += -pg +ICC_CFLAGS = -O0 -g3 -std=c99 -Wall +#LFLAGS += -pg ICC ?= true GCCO1 ?= true @@ -25,67 +24,79 @@ LFLAGS += $(FIRM_LIBS) SOURCES := \ adt/hashset.c \ adt/strset.c \ - adt/obstack.c \ - adt/obstack_printf.c \ - adt/xmalloc.c \ + attribute.c \ + parser.c \ ast.c \ ast2firm.c \ + builtins.c \ diagnostic.c \ + driver/firm_machine.c \ + driver/firm_opt.c \ + driver/firm_timing.c \ + entity.c \ + entitymap.c \ format_check.c \ lexer.c \ main.c \ - parser.c \ + mangle.c \ + preprocessor.c \ + printer.c \ symbol_table.c \ token.c \ type.c \ - types.c \ type_hash.c \ + types.c \ + walk_statements.c \ warning.c \ - write_fluffy.c \ - driver/firm_cmdline.c \ - driver/firm_timing.c \ - driver/firm_codegen.c \ - driver/firm_opt.c \ - driver/gen_firm_asm.c \ + wrappergen/write_fluffy.c \ + wrappergen/write_jna.c OBJECTS = $(SOURCES:%.c=build/%.o) SPLINTS = $(addsuffix .splint, $(SOURCES)) CPARSERS = $(addsuffix .cparser, $(SOURCES)) CPARSEROS = $(SOURCES:%.c=build/cpb/%.o) +CPARSEROS_E = $(SOURCES:%.c=build/cpbe/%.o) +CPARSEROS2 = $(SOURCES:%.c=build/cpb2/%.o) Q = @ -.PHONY : all clean dirs - all: $(GOAL) +.PHONY: all clean bootstrap bootstrap2 + ifeq ($(findstring $(MAKECMDGOALS), clean depend),) -include .depend endif +config.h: + cp config.h.in $@ + %.h: @true -.depend: $(SOURCES) - @echo "#define cparser_REVISION \"`svnversion -n .`\"" > .revision.h +REVISION ?= $(shell svnversion -n .) + +revision.h: + @echo "===> GEN $@" + @echo "#define cparser_REVISION \"$(REVISION)\"" > .revision.h $(Q)if diff -Nq .revision.h revision.h > /dev/null; then \ rm .revision.h; \ else \ echo "===> UPDATING revision.h"; \ mv .revision.h revision.h; \ fi + +.depend: config.h revision.h $(SOURCES) @echo "===> DEPEND" @rm -f $@ && touch $@ && makedepend -p "$@ build/" -Y -f $@ -- $(CPPFLAGS) -- $(SOURCES) 2> /dev/null && rm $@.bak -$(GOAL): build/adt build/driver $(OBJECTS) - @echo "===> LD $@" - $(Q)$(CC) $(OBJECTS) $(LFLAGS) -o $(GOAL) +DIRS = build build/adt build/driver build/wrappergen build/cpb build/cpb/adt build/cpb/driver build/cpb/wrappergen build/cpb2 build/cpb2/adt build/cpb2/driver build/cpb2/wrappergen build/cpbe build/cpbe/adt build/cpbe/driver build/cpbe2/wrappergen +UNUSED := $(shell mkdir -p $(DIRS)) -cparser.bootstrap: $(CPARSEROS) +$(GOAL): $(OBJECTS) $(LIBFIRM_FILE) @echo "===> LD $@" - $(Q)$(CC) $(CPARSEROS) $(LFLAGS) -o $@ - + $(Q)$(CC) $(OBJECTS) $(LFLAGS) -o $(GOAL) splint: $(SPLINTS) @@ -93,6 +104,10 @@ selfcheck: $(CPARSERS) bootstrap: build/cpb build/cpb/adt build/cpb/driver $(CPARSEROS) cparser.bootstrap +bootstrape: build/cpb build/cpb/adt build/cpb/driver $(CPARSEROS_E) cparser.bootstrape + +bootstrap2: build/cpb2 build/cpb2/adt build/cpb2/driver $(CPARSEROS2) cparser.bootstrap2 + %.c.splint: %.c @echo '===> SPLINT $<' $(Q)splint $(CPPFLAGS) $< @@ -101,21 +116,42 @@ bootstrap: build/cpb build/cpb/adt build/cpb/driver $(CPARSEROS) cparser.bootstr @echo '===> CPARSER $<' $(Q)./cparser $(CPPFLAGS) -fsyntax-only $< -build/adt build/driver build/cpb build/cpb/adt build/cpb/driver: - @echo "===> MKDIR $@" - $(Q)mkdir -p $@ +gen_builtins.h: builtins/builtins.c create_builtins_h.sh + @echo '===> CREATE_BUILTINS $<' + $(Q)./create_builtins_h.sh "$<" > $@ + +main.c: gen_builtins.h -build/cpb/%.o: %.c +build/cpb/%.o: %.c build/cparser @echo '===> CPARSER $<' - $(Q)./cparser $(CPPFLAGS) -Wall -g -c $< -o $@ + $(Q)./build/cparser $(CPPFLAGS) -std=c99 -Wall -g3 -c $< -o $@ + +build/cpbe/%.o: %.c + @echo '===> ECCP $<' + $(Q)eccp $(CPPFLAGS) -std=c99 -Wall -c $< -o $@ + +build/cpb2/%.o: %.c cparser.bootstrap + @echo '===> CPARSER.BOOTSTRAP $<' + $(Q)./cparser.bootstrap $(CPPFLAGS) -Wall -g -c $< -o $@ + +cparser.bootstrap: $(CPARSEROS) + @echo "===> LD $@" + $(Q)./build/cparser $(CPARSEROS) $(LFLAGS) -o $@ + +cparser.bootstrape: $(CPARSEROS_E) + @echo "===> LD $@" + $(Q)gcc $(CPARSEROS_E) $(LFLAGS) -o $@ + +cparser.bootstrap2: $(CPARSEROS2) + @echo "===> LD $@" + $(Q)./cparser.bootstrap $(CPARSEROS2) $(LFLAGS) -o $@ build/%.o: %.c @echo '===> CC $<' -#-$(Q)build/cparser $(CPPFLAGS) $(CFLAGS) -fsyntax-only $< - $(Q)$(ICC) $(CPPFLAGS) $(ICC_CFLAGS) -c $< -o $@ - $(Q)$(GCCO1) $(CPPFLAGS) $(CFLAGS) -O1 -c $< -o $@ +#$(Q)$(ICC) $(CPPFLAGS) $(ICC_CFLAGS) -c $< -o $@ +#$(Q)$(GCCO1) $(CPPFLAGS) $(CFLAGS) -O1 -c $< -o $@ $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ clean: @echo '===> CLEAN' - $(Q)rm -rf build/* $(GOAL) .depend + $(Q)rm -rf gen_builtins.h build/* $(GOAL) .depend