Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Buesch <[email protected]>
  • Loading branch information
mbuesch committed Jul 29, 2012
0 parents commit f5d2338
Show file tree
Hide file tree
Showing 9 changed files with 1,596 additions and 0 deletions.
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions encoder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
morse_encoder

dep
obj
.*.swp
~*
53 changes: 53 additions & 0 deletions encoder/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# The toolchain definitions
CC = cc
SPARSE = sparse

V = @ # Verbose build: make V=1
C = 0 # Sparsechecker build: make C=1
Q = $(V:1=)
QUIET_CC = $(Q:@=@echo ' CC '$@;)$(CC)
QUIET_DEPEND = $(Q:@=@echo ' DEPEND '$@;)$(CC)
ifeq ($(C),1)
QUIET_SPARSE = $(Q:@=@echo ' SPARSE '$@;)$(SPARSE)
else
QUIET_SPARSE = @/bin/true
endif

PREFIX ?= /usr/local
CFLAGS ?= -Os -fomit-frame-pointer
CFLAGS += -std=c99 -Wall -pedantic -D_BSD_SOURCE
LDFLAGS ?=

SRCS = morse_encoder.c
BIN = morse_encoder

.SUFFIXES:
.PHONY: all install clean distclean
.DEFAULT_GOAL := all

DEPS = $(sort $(patsubst %.c,dep/%.d,$(1)))
OBJS = $(sort $(patsubst %.c,obj/%.o,$(1)))

# Generate dependencies
$(call DEPS,$(SRCS)): dep/%.d: %.c
@mkdir -p $(dir $@)
$(QUIET_DEPEND) -o $@.tmp -MM -MG -MT "$@ $(patsubst dep/%.d,obj/%.o,$@)" $(CFLAGS) $< && mv -f $@.tmp $@

-include $(call DEPS,$(SRCS))

# Generate object files
$(call OBJS,$(SRCS)): obj/%.o:
@mkdir -p $(dir $@)
$(QUIET_SPARSE) $(SPARSEFLAGS) $<
$(QUIET_CC) -o $@ -c $(CFLAGS) $<

all: $(BIN)

$(BIN): $(call OBJS,$(SRCS))
$(QUIET_CC) $(CFLAGS) -o $(BIN) $(call OBJS,$(SRCS)) $(LDFLAGS)

clean:
-rm -Rf obj dep *.orig *.rej *~

distclean: clean
-rm -f $(BIN)
Loading

0 comments on commit f5d2338

Please sign in to comment.