Skip to content

Commit

Permalink
Use better runtime/Makefile rules for `gen/{ml-types.h,c-types.{c,s…
Browse files Browse the repository at this point in the history
…ml}}`

Avoid using `.stamp` files and generate proper `Makefile`
dependencies.
  • Loading branch information
MatthewFluet committed Jan 16, 2020
1 parent 36494b0 commit ac1651a
Show file tree
Hide file tree
Showing 3 changed files with 277 additions and 232 deletions.
23 changes: 16 additions & 7 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,23 @@ c-types.h: gen/c-types.h
cp $< $@
ml-types.h: gen/ml-types.h
cp $< $@
gen/c-types.h gen/c-types.sml gen/ml-types.h: gen/gen-types.stamp
@touch $@
gen/gen-types.stamp: gen/gen-types.c util.h util.o

gen/ml-types.h: gen/gen-types$(EXE)
./gen/gen-types$(EXE) ml-types.h > gen/ml-types.h
gen/c-types.h: gen/gen-types$(EXE)
./gen/gen-types$(EXE) c-types.h > gen/c-types.h
gen/c-types.sml: gen/gen-types$(EXE)
./gen/gen-types$(EXE) c-types.sml > gen/c-types.sml

gen/gen-types$(EXE).d: gen/gen-types.c
$(CROSS_PREFIX)$(CC) $(OPTCFLAGS) -M -MG -MT gen/gen-types$(EXE) -MT gen/gen-types$(EXE).d -MF gen/gen-types$(EXE).d gen/gen-types.c

ifneq ($(MAKECMDGOALS),clean)
-include gen/gen-types$(EXE).d
endif

gen/gen-types$(EXE): util.o
$(CROSS_PREFIX)$(CC) $(OPTCFLAGS) -o gen/gen-types gen/gen-types.c util.o
rm -f gen/c-types.h gen/c-types.sml gen/ml-types.h gen/gen-types.stamp
cd gen && ./gen-types
rm -f gen/gen-types$(EXE) gen/gen-types
touch $@

### basis-ffi.h gen/basis-ffi.sml ###

Expand Down
1 change: 0 additions & 1 deletion runtime/gen/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
/gen-sizes.exe
/gen-types
/gen-types.exe
/gen-types.stamp
/ml-types.h
/sizes
Loading

0 comments on commit ac1651a

Please sign in to comment.