2 ms·
Sure. Here's viola, a web browser from the early 90s, with a replacement makefile (GNU make) that's a bit more sane: CC = gcc -std=c99 -Wall -Wextra
by spc476 2y ago
Sure. Here's viola, a web browser from the early 90s, with a replacement makefile (GNU make) that's a bit more sane:
CC = gcc -std=c99 -Wall -Wextra -pedantic
CFLAGS = -g
LDFLAGS = -g
LDLIBS = -L/usr/X11R6/lib -lICE -lSM -lXpm -lX11 -lXext -lXmu -lXt -lm
VIOLA_PATH := $(shell pwd)/resources
override CFLAGS += -DPOSIX_C_SOURCE=199309L \
-D_POSIX_SOURCE -D_XOPEN_SOURCE \
-D_BSD_SOURCE -D_SVID_SOURCE \
-DDEFAULT_VIOLA_PATH='"$(VIOLA_PATH)"'\
-DVIOLA
%.a:
$(AR) $(ARFLAGS) $@ $?
viola/viola: $(patsubst %.c,%.o,$(wildcard viola/*.c)) \
libIMG/libIMG.a \
libXPA/src/libxpa.a \
libStyle/libStyle.a \
libWWW/libWWW.a \
parmcheck.o
libIMG/libIMG.a : $(patsubst %.c,%.o,$(wildcard libIMG/*.c))
libXPA/src/libxpa.a : $(patsubst %.c,%.o,$(wildcard libXPA/src/*.c))
libStyle/libStyle.a : $(patsubst %.c,%.o,$(wildcard libStyle/*.c))
libWWW/libWWW.a : $(patsubst %.c,%.o,$(wildcard libWWW/*.c))
It's 155,000 lines of C code across 361 files. Not shown are the nearly 900 lines that make up the dependencies, but using `makedepend` (which came with my system) makes short work of that. I have a more complicated project that compiles an application written in Lua into a Linux executable. It wasn't hard to write, given that you can always add new rules to `make`, such as converting a `.lua` file to a `.o` file:
%.o : %.lua
$(BIN2C) $(B2CFLAGS) -o $*.l.c $<
$(CC) $(CFLAGS) -c -o $@ $*.l.c
$(RM) $*.l.c
Okay, that requires a custom tool (`bin2c`) but can other build systems do this? I honestly don't know.