tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Makefile.basic (1414B)


      1 # A basic Makefile that KaRaMeL copies in the output directory; this is not
      2 # guaranteed to work and will only work well for very simple projects. This
      3 # Makefile uses:
      4 # - the custom C files passed to your krml invocation
      5 # - the custom C flags passed to your krml invocation
      6 # - the -o option passed to your krml invocation
      7 
      8 include Makefile.include
      9 
     10 ifeq (,$(KRML_HOME))
     11  $(error please define KRML_HOME to point to the root of your KaRaMeL git checkout)
     12 endif
     13 
     14 CFLAGS 	+= -I. -I $(KRML_HOME)/include -I $(KRML_HOME)/krmllib/dist/minimal
     15 CFLAGS 	+= -Wall -Wextra -Werror -std=c11 \
     16  -Wno-unknown-warning-option \
     17  -Wno-infinite-recursion \
     18  -g -fwrapv -D_BSD_SOURCE -D_DEFAULT_SOURCE
     19 ifeq ($(OS),Windows_NT)
     20 CFLAGS 	+= -D__USE_MINGW_ANSI_STDIO
     21 else
     22 CFLAGS 	+= -fPIC
     23 endif
     24 CFLAGS 	+= $(USER_CFLAGS)
     25 
     26 SOURCES += $(ALL_C_FILES) $(USER_C_FILES)
     27 ifneq (,$(BLACKLIST))
     28  SOURCES := $(filter-out $(BLACKLIST),$(SOURCES))
     29 endif
     30 OBJS 	+= $(patsubst %.c,%.o,$(SOURCES))
     31 
     32 all: $(USER_TARGET)
     33 
     34 $(USER_TARGET): $(OBJS)
     35 
     36 AR ?= ar
     37 
     38 %.a:
     39 $(AR) cr $@ $^
     40 
     41 %.exe:
     42 $(CC) $(CFLAGS) -o $@ $^ $(KRML_HOME)/krmllib/dist/generic/libkrmllib.a
     43 
     44 %.so:
     45 $(CC) $(CFLAGS) -shared -o $@ $^
     46 
     47 %.d: %.c
     48 @set -e; rm -f $@; \
     49   $(CC) -MM -MG $(CFLAGS) $< > $@.$$$$; \
     50   sed 's,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g' < $@.$$$$ > $@; \
     51   rm -f $@.$$$$
     52 
     53 include $(patsubst %.c,%.d,$(SOURCES))
     54 
     55 clean:
     56 rm -rf *.o *.d $(USER_TARGET)